Progress Bar not updating correctly

chinnybloke
03-15-2006, 05:50 AM
Hi,

I am trying to display progress to the user during processing of a loop which may run many thousands of times.

I open a simple form which displays two datetime picker controls to select the start and end dates for a report. When the users clicks to generate the report, I have a progress bar which should update every 20 iterations of the loop. However, sometimes it works fine, other times it does a couple of blocks on the progress bar then nothing. MY form says "not responding" at the top but after say 20 seconds the form clears and it shows my report so I think its just not processing Paint requests sometimes. How do I ensure paints are processed?

My progressBar.Step value is 20 so it should only update every 20 iterations of the loop.

Here is my code:

If ((lnToProcess Mod progressBar.Step()) = 0) Then
progressBar.PerformStep()
progressBar.Refresh()
End If


Many thanks,
Paul

Mikecrosoft
03-15-2006, 12:07 PM
trying with

Application.DoEvents()

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum