Simple Form Question
Posted on 2006-06-29
I have a C# form with three objects.
A label, a textfield and a button.
When the button is pressed, it will run a for loop
run where i=0 until i=integer entered in text field.
I want to do it where if the number entered is large then after the button is pressed, the label will say "Running..." until it's done, then "completed." when it's done.
here's my code
label2.Text = "Running.";
for (int i = 0; i < Convert.ToInt32(textBox1.Text); i++)
label2.Text = "Completed.";
I know it's amateurish to do it this way cuz it doesn't work. It will freeze until it's done counting then label2.Text will just = "Completed." And "running." is never seen.
How do I code it so it will say "Running" after the button is pressed and show "Completed" when it is completed?