Hi all,
I am using arrays for a timer in one of the programs I am creating. I have a stop watch that starts counting when the timer is enabled.
I have three arrays:
lblTime(2) - for milliseconds
lblTime(1) - for seconds
lblTime(3) - for minutes
The problem is that when it comes to the part when the minutes have to be changed i.e. when 60 seconds occur... I get an error saying that lblTime(3) Array does not exist.
Here is the code I am using:
VB Code:
Private Sub Timer_Timer() If Me.Enabled = True Then T2 = T2 + 1 If T2 < 10 Then lblTime(2).Caption = "0" & T2 Else lblTime(2).Caption = T2 End If If T2 = 60 Then T2 = 0 T1 = T1 + 1 If T1 < 10 Then lblTime(1).Caption = "0" & T1 Else lblTime(1).Caption = T1 End If End If If T1 = 60 Then T1 = 0 T0 = T0 + 1 If T0 < 10 Then lblTime(3).Caption = "0" & T0 Else lblTime(3).Caption = T0 End If End If End If End Sub
Any help would be appreciated...
Khanjan





Reply With Quote