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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress Bar?

Status
Not open for further replies.

anyideas

Programmer
May 2, 2002
127
GB
Hi,

I have a while loop which takes about 30 seconds to a minute to complete... it creates a 100mb pdf file. Can I put a progress bar into the form to show the status of the loop, and if so, how?

Mark
 
You can find a progress bar in the windows common controls component. Set its min val to you start value of your loop and set the max value to your loops max value. At the bottom of yuor for loop set the progress bars value to the current count eg...


lMin = 0
lMax = 100
progressbar1.min = lMin
progressbar1.max = lMax
for i = lMin to lMax
....
progressbar1.value=i
next
 
Don't forget to add a DoEvents and a form.refresh into the loop!

Matt
 
Cheers Sjravee, Matt

Why would I need to add a DoEvents?

Mark
 
If you have a loop that is taking that long to execute (30 seconds - 1 minute) it is probably best to include DoEvents as without it your program will appear as 'Not Responding' in the Task Manager - which can be off putting for customers (if you intend to sell your program that is).

Be wary though as DOEvents can lead to unwanted effects such as undesired re-entry into procedures.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top