hi plz help me, i would like to know if got two timer in form( vb), does it run parallel or synchronous. i got problem here where i want to calculate time duration the formula is EndTime-StartTime. I code the StartTime in first timer and the EndTime in second Timer(Timer2) with 5s and 10s Interval each. BUT i facing problem here where the Time Duration is inaccurate eventhough the formula is correct. I created array of 4 for startTime n End Time. Plz guide me to solve this problem.
Private Sub Timer1_Timer()
Randomize
lblCar(n).Capti on = Int(Rnd() * 50)
StartTime = Now
lblStart(n).Cap tion = Format(StartTim e, "hh:mm:ss")
n = n + 1
If n = 4 Then
Timer1.Enabled = False
End If
End Sub
Private Sub Timer2_Timer()
EndTime = Now
lblEnd(i).Capti on = Format(EndTime, "hh:mm:ss")
Timeduration = DateDiff("s", StartTime, EndTime)
lblDuration(i). Caption = "" & Timeduration
i = i + 1
If i = 4 Then
Timer2.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
Randomize
lblCar(n).Capti on = Int(Rnd() * 50)
StartTime = Now
lblStart(n).Cap tion = Format(StartTim e, "hh:mm:ss")
n = n + 1
If n = 4 Then
Timer1.Enabled = False
End If
End Sub
Private Sub Timer2_Timer()
EndTime = Now
lblEnd(i).Capti on = Format(EndTime, "hh:mm:ss")
Timeduration = DateDiff("s", StartTime, EndTime)
lblDuration(i). Caption = "" & Timeduration
i = i + 1
If i = 4 Then
Timer2.Enabled = False
End If
End Sub
Comment