|
-
Jan 19th, 2004, 03:00 PM
#1
Thread Starter
Hyperactive Member
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?
-
Jan 19th, 2004, 03:05 PM
#2
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.
-
Jan 19th, 2004, 03:18 PM
#3
Thread Starter
Hyperactive Member
That did the trick!
Thank you,
Joe
-
Jan 20th, 2004, 01:32 PM
#4
Thread Starter
Hyperactive Member
That did the trick!
Thank you,
Joe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|