This is my code:
Stopwatch timer = new Stopwatch();
timer.Start();
while (timer.ElapsedMilliseconds < 3000) {
label1.Text = Convert.ToString( timer.El
Is this a WinForms app?
The problem is that while your loop runs, it does not give any other tasks (like updating the GUI) any possibility to get done, so the GUI will update the the entire loop is complete.
You can add a quick and "dirty" solution here (if WinForms). Modify your loop like this:
while (timer.ElapsedMilliseconds < 3000) {
label1.Text = Convert.ToString( timer.ElapsedMilliseconds );
Application.DoEvents();
}
Now the label should update in between the loop runs.