Progress Bar does not Finish

M

Miro

I have a backgroundworker thread, and on progress changed I send the % done
to the progess changed event.

I have a progress bar on the form with a maximum value of 100 and a minimum
value of 0

As the percentage gets updated the progress bar updates properly...
the progress bar paints to about 75% and then the worker is done 'working',
the progressbar.value = 100 but the display still shows it at about 75%
When the backgroundworker complete fires, i hide the progress bar. So the
user only sees it hit about 75% and then poof everything is done.

I understand the refresh on the progress bar may be too slow .
Is there any way to 'slow down and wait' within the background worker
complete to wait for it to refresh and paint to 100 before it continues and
hides it?

I have tried to put a sleep and a progressbar1.refresh on the completed
event and its just not fast enough.

This is not a big issue - i just wanted to make the user see pretty things.

Miro
 
A

Alex Clark

Hi Miro,

As this is just a case of visual representation, why not "lie" when you
handle your progress event and report a higher %age progress than you've
actually made?

From what I can gather, you hide the progress bar as soon as your background
worker has completed - so in essence, the very instant the progress bar hits
100% it's then made invisible, so the user never sees it fill up all the
way. If you're reporting progress in 25% increments, just add 25% to the
progress when you update the progress bar. Then it will briefly pause on
"full" (when you're only 75% done) before going invisible when your task
actually completes. Assuming you haven't got large pauses between status
updates, this should suffice - just remember not to set your progress bar
value to 125%, or it'll throw an exception for exceeding the Max Value.

HTH
Alex
 
A

Armin Zingler

Miro said:
I understand the refresh on the progress bar may be too slow .
Is there any way to 'slow down and wait' within the background worker
complete to wait for it to refresh and paint to 100 before it continues and
hides it?

How long do you expect the progressbar to be visible after displaying
100%? I'd use a Timer to hide it after it has reached this value. Is the
UI thread busy after reaching 100%?


Armin
 
M

Miro

No the main User thread is now awaiting input from the user as the
background has now completely stopped.

Basically a "new dataset table" was created and all they have to do is view
it and click a button to re-export that out to an excel file.

I suppose I can use a timer... thats not a bad idea.

Start a "timer" on the "worker completed" task, and then stop it after.
Give the illusion of a 2 second more processing while I finish updating the
progress bar and just udpate it faster.

I will try to see if this works.
Thanks,

Miro
 

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

Top