Loop but update form without "hanging"
I'm doing a big loop in my program and throughout the loop I'm updating the textbox in the form.
However the form "hangs" untill the loop is done. How can I keep the form visible and be able to read the updated textbox while the loop is still running?
I tried Me.Update() but it didn't work. I'm sure there was something like processdata or something like that but I can't find it anymore...
Example
Code:
For x = 1 To 10000
form1.textbox.text=x
Me.Update()
Next
Re: Loop but update form without "hanging"
Add Application.Doevents into the cycle body.
Code:
For x = 1 To 10000
form1.textbox.text=x
Application.DoEvents()
Next
Re: Loop but update form without "hanging"
yes that was it!!! application.doevents().
thanks!