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?
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
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.