-
Progress Bar
I have a program that calculates averages for a field by stepping through two database tables using two loops. The problem I'm having is notifying the user of the progress. Since the program takes about two minutes to run, I put a progress bar on the form that updates every time through the first loop. When I run the program, it works fine but the progress bar doesn't do anything until the end. It appears as though the program is locked up for two minutes and when it ends, the progress bar jumps to 100%. It does the same thing if I use a label and update it using a counter (like z=z+1). While the program runs, it shows nothing in the label and then at the end it shows the total number of rows it did. Does anyone know what would cause this?
-
Sounds like you have the UI thread locked up while its processing. Depending on how you are doing the actual work and whether or not you want the user to be able to interact with the UI while it is working or not, changes the solution. Although generally speaking you can use Application.DoEvents to force any held process to run, like the painting of controls. So everytime you update the progressbar or label try using Application.DoEvents right after it. Otherwise post your code for more help.
-
That did the trick!
Thank you,
Joe
-
That did the trick!
Thank you,
Joe