Posted on: 3/13/2015 7:03:41 PM | Views : 621

hi. i am a new .net developer. so this question may sound like a simple stupid thing. but I dont understand why my variables stays 0 when I click btnExecute_Click
int countTrue = 0; int countFalse = 0;
protected void btnExecute_Click(object sender, EventArgs e) { int[] arrNumbers = randomNumbers();
int num1 = arrNumbers[0]; int num2 = arrNumbers[1];
string display = num1 + "+" + num2; int result = num1 + num2;
if (txtField.Text == result.ToString()) { lblStatus.Text = display; countTrue++; } else { lblStatus.Text = display; countFalse++; }
lblCountTrue.Text = "True: " + countTrue; lblCountFalse.Text = "False: " + countFalse; } can someone tell me why my int CountTrue and int CountFalse will always return 0 ?

Go to the complete details ...