-
What is the best way to set the max for a progess bar and also the value for it. I need to show the progress for searching directories and finding matched files according to the searching criteria. Sample code:
For counter = 1 To lngDriveLen Step 4
List1.AddItem (Mid(txtDriveName, counter, 3))
ProgressBar1.Value = counter
Next counter
HELP!!!
-
For the little sample you provided, set the Max property of the ProgressBar to lngDriveLen (or in general cases, the Max property will represent the total amount of stuff that needs to be done). You have the right idea with putting counter into the Value property, but you may want to stick an On Error Resume Next statement just before setting the value. I've noticed some times where setting the value of a progress bar can make an error even if the value is legal based on the Min and Max properties.
Code:
ProgressBar1.Min = 1
ProgressBar1.Max = lngDriveLen
For counter = 1 To lngDriveLen Step 4
List1.AddItem (Mid(txtDriveName, counter, 3))
On Error Resume Next
ProgressBar1.Value = counter
Next counter
-
Thanks!