Small problem with label or textbox updates
I have a small, yet annoying problem. When I perform a "FOR" or "DO", I want to update a label or textbox as the loop progresses, for example: if I want to display a percentage done while incrementing a ProgressBar. The problem is that the label or textbox will never update, it wont even clear when I restart the loop!
simplified code example:
The label clear and = i never happen, only the "Done!"
Code:
ProgressBar1.Value = 0
ProgressBar1.Maximum = 150
Label1.Text = " "
For i = 0 To 150
ProgressBar1.Increment(2)
i += 1
System.Threading.Thread.Sleep(5)
Label1.Text = i
Next
Label1.Text = "Done!"