Hi, I'm writing a program where I call a method that for one of its parameters is a global variable. The issue i'm running into is that when the calculations are done the parameter's value changes, but it does not affect the global variable. I figured it would change the global variable to. Is there something I'm missing?


Here is the Triggered event:

Code:
        private void txtMortguageJan_TextChanged(object sender, EventArgs e)
        {
            CalculateMortguage(0,txtMortguageJan, arMortguage, lblYrMortguage, decYrMortguage);
        }
Here is the called Method:

Code:
        private void CalculateMortguage(int intArrayIndex, TextBox txtTextBox, 
decimal[] decarray, Label lblLabel, decimal decYrTotal)
        {
            txtTextBox.BackColor = Color.White;//resets the background of the text box to white
            try
            {
                //--------------------------------------------------------------------------
                if (txtTextBox.Text == "")// checks to see if the text box is blank
                {
                    decarray[intArrayIndex] = 0;
                }
                else if (txtTextBox.Text.StartsWith("."))//checks to see of text box begins with a period
                {
                    txtTextBox.Text = "0.";//changes the textbox to "0."
                    txtTextBox.Select(txtTextBox.Text.Length, 0);
                    decarray[intArrayIndex] = 0;//sets variable to 0
                }
                else//valid text entry
                {
                    decarray[intArrayIndex] = Convert.ToDecimal(txtTextBox.Text);
                }
                //--------------------------------------------------------------------------
                decYrTotal = 0;// resets the govt rent variable
                foreach (decimal d in decarray)//loops through each month and adds them up
                {
                    decYrTotal += d;
                }
                lblLabel.Text = decYrTotal.ToString("0.00");//puts the year's total into the label
                CalculateExpensesTotal();//calls method
            }
            catch
            {
                txtTextBox.BackColor = Color.Red;//if error it changes text box color to alert user.
            }
        }
The global variable that is not changing is decYrMortguage, and the parameter I use it in is decYearTotal. When I debug the code, after is loops through the array decYearTotal changes, but when I look at decYrMortguage it's value remains at 0.

Thanks.