Forum Moderators: open
I wrote a small program and extract some text from heaps of files in a particular folder. I developed a progressbar on a seperated form to indicate the status of the execution.
Here is part of my code :
Static max As Integer
max = 250 'total width of the progress bar
Dim progress As Single
progress = (pointer / total) * max
Me.Label1 = "Extracting Email Address ... (" & pointer & " of " & total & ")"
Me.Label_Progressbar.Width = CInt(progress)
Me.Repaint
When i run the code, everything is fine and the car is progressing but the form is frozen. All buttons on this form become unclickable.
Is this a threading problem? Do you have any clue to fix this issue?
Thank you very much
Sean
One solution is to introduce a DoEvents into the loop
Do While dadada
'process
'update progress bar
DoEvents
Loop
DoEvents are to be used sparingly - they allow repaints ets to happen but it also means buttons can be pressed - including the button that the user pressed in the first place to start this processing. You will probably have to disable at least one button and re-enable it later