Results 1 to 4 of 4

Thread: Progress Bar

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    Connecticut
    Posts
    257

    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?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    Connecticut
    Posts
    257
    That did the trick!

    Thank you,

    Joe

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    Connecticut
    Posts
    257
    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
  •  



Click Here to Expand Forum to Full Width