Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do the progress bar last the same time as a process in a applic

Status
Not open for further replies.

cristin

Technical User
Sep 17, 2001
12
0
0
ES

Hi everyone,

My application performs a process which last a certain period of time that is variable, you know. And, besides, I can not know that time previously or before starting the mentioned process. When I push the play button on a toolbar the process starts. Then, a form that contains a progress bar is showed. The question is: How can I do that the filling of the progress bar last the same time as the process do?

Thanks in advance

Bye

Cris
 
You'll have to determine some way of keeping track of how far along the process is. In other words, if your loop is from 0 to NumOfLoops, then set ProgressBar1.Max = NumOfLoops - 1 and increment it's Value by one each time through the loop. (You'll need a DoEvents statement right afterwards so the progress bar's graphics have a chance to be updated) If you have a series of calculations and other processes where there isn't really a way to do this, then my solution was to set its value to something relatively descriptive, like 30% of its Max after the first of 3 lengthy routines. Any other ideas out there?

-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
If you can't predict the future, then neither can VB or Windows.

I have seen some programs that cheat - I mean REALLY cheat - and some of them have been MS programs too.

They sort of plod along filling in the bar as they go, a bit at a time, but never quite fill past 80% or so. If the process gets done before they hit 80% they go ziiippp! and fill it to 100%. If they hit their 80% of the progress bar they just let it sit there and go ziiipppp! when it finally completes.

Personally I find this frustrating as a user, but maybe it was better than NO progress bar? The problem is it doesn't actually tell the user anything. Just lets them know the program hasn't locked up I guess - even though when it sits at 80% what would YOU conclude after a minute or two?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top