Figuring out Timer Interval for Progress Bar
Posted on 2004-08-23
I'm having a really hard time wrapping my brain around this one.
I have a button, a timer, and a progress bar.
Dim L As Label
TotalTime = "0" 'set the variable that tracks the total required time to 0
For i = 1 To 5
Set L = Form1("Liq" & i & "_Amount")
TotalTime = Val(TotalTime) + Val(L) 'for each value, add it to the total time required
pbtimer.Interval = Val(TotalTime) 'PROBLEM LINE - this is where I think the error lies
pbtimer.Enabled = True
Then the timer code is
Private Sub pbtimer_Timer()
If ProgressBar1.Value = 100 Then
ProgressBar1.Value = ProgressBar1.Value + Val(TotalTime) 'add one percent to the progress bar
So, let's say I need .99 total seconds to complete the task at hand. How do I set the timer interval to fire off every one hundreth of the required time? Times 1000 for the timer's interval? How does the percent (1/100) of what I want to do and the 1/1000 = one second property of the timer both interact? See my confusion? (...maybe this is more a math question than a VB question?)