I am creating a golfing app. It is a 9 hole golf course. I created a page that has 9 separate text blocks that the user can enter in their score for each hole. Then I have a textbox that I want the final score to be put in. I know how to do this if I put a button to just add up all of the scores at the end, but what I am trying to get it to do, is to add them up once the score is put in. So when the user enters in their first score, the total box will put that one in it, then when the second score is put in its respective box, I want it to add that score to the total etc... for all 9 blocks.
I am creating this as a Windows Phone App with C#
private void Calculate_Click(object sender, RoutedEventArgs e)
{
int x1 = int.Parse(textBox1.Text);
int x2 = int.Parse(textBox2.Text);
int x3 = int.Parse(textBox3.Text);
int x4 = int.Parse(textBox4.Text);
int x5 = int.Parse(textBox5.Text);
int x6 = int.Parse(textBox6.Text);
int x7 = int.Parse(textBox7.Text);
int x8 = int.Parse(textBox8.Text);
int x9 = int.Parse(textBox9.Text);
int total = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9;
TotalBlock.Text = total.ToString();
}