Can't update Label while ProgressBar is moving...

  • Thread starter Thread starter Charlie@CBFC
  • Start date Start date
C

Charlie@CBFC

Hi:

I'm trying to implement a ProgressBar with a label to show progress. On
each increment of ProgressBar label text is updated but label doesn't show
any changes until progressbar is done. Why?

Thanks,
Charlie
 
Charlie@CBFC said:
Hi:

I'm trying to implement a ProgressBar with a label to show progress. On
each increment of ProgressBar label text is updated but label doesn't show
any changes until progressbar is done. Why?

Thanks,
Charlie

Since this isn't .Net specific, I figure I can pop in.... Screen updates are
very low priority to the OS. If they weren't, all apps would be dog slow.
It's up to the developer to allow the screen to be repainted. In VB6, we'd
usually sprinkle a DoEvents in key places to allow this to happen. Thing is,
each DoEvents takes a chunk of time (upto 110ms on some systems) so, you
have the choice of a fast app or constant screen updates. The key is finding
the right combination of both.
 
A call to form's update method on each tick did the trick. I guess form
can't repaint itself fast enough to keep up with progress bar so you have to
force it.

Charlie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top