C# returning results

Hello I’m working on this problem for class.

It should be simple but I seem to be making a big deal out of it :nono:

<script runat="server">
    int acctBalance = 500;
    int balUp, balDown;

void Page_Load(Object s, EventArgs e)
            sBalance.Text = acctBalance.ToString();
void Click(Object s, EventArgs e)
        int deposit;
        deposit = computeDeposit(balUp, balDown);
        //Convert deposit and widthdrawal amounts to int
        balUp = Convert.ToInt32(dAmount.Text);
        balDown = Convert.ToInt32(wAmount.Text);
        aBalance.Text = deposit.ToString();
    //Function to deposit funds to account

    int computeDeposit(int x, int y)
    { int results;
        results = acctBalance + x - y;
        return results;

<form id="form1" runat="server">
Starting Account Balance:<asp:Label ID="sBalance" runat="server" Text=""></asp:Label><br />
Account Name:&nbsp;<asp:TextBox ID="aName" runat="server"></asp:TextBox><br />
Account Number:&nbsp;<asp:TextBox ID="aNumber" runat="server"></asp:TextBox><br />
Deposit Amount:&nbsp;<asp:TextBox ID="dAmount" runat="server"></asp:TextBox><br />
Withdrawal Amount:&nbsp;<asp:TextBox ID="wAmount" runat="server"></asp:TextBox>
    <br />
    <br />
<asp:Button ID="Button1" runat="server" OnClick="Click" Text="Update Balance" />
Adjusted Blance:<asp:Label ID="aBalance" runat="server" Text=""></asp:Label>

Basically what’s going on here is there is an account balance with 500 as the value.

a person will enter an amount to deposit and an amount to withdraw. Then that balance is displayed in the label.

What’s happening now is acctBalance is not being updated in my function. is that because I initialized it as a global?

I found it - aBalance.Text = computeDeposit(balUp, balDown).ToString();