May 20, 2019
Hot Topics:

VB Coding Tip: Using the Progress Bar to Measure Action

  • November 19, 2002
  • By Alan Young
  • Send Email »
  • More Articles »

In creating a program recently, I wanted my VB 5 progress bar to show action, rather than percent complete. So I came up with a technique where I initialize:


Then in a later loop where I am displaying progress as I move through a file, my code says:

ProgressBar1.Value=X mod 1000

X is a count of records read from a file, which I have no way of knowing the number of records beforehand. This way, using MOD, I never have an out of range error in setting the progress bar value. Once the number of records is over 1000, then using MOD, the progressbar is reset to 0.

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date