Dim TotalTenthSeconds, TotalSeconds, TenthSeconds,
Seconds, _
Minutes, Hours As Integer
Private Sub Command1_Click()
'
initilize the Total tenth seconds
TotalTenthSeconds
= -1
' start the
timer
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
' start or stop the timer
Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Timer1_Timer()
'
increase the total amount of Tenth Seconds.
' we set
the timer interval to 10, so every tenth second
'
this sub will be executed
TotalTenthSeconds =
TotalTenthSeconds + 1
' if the
TotalTenthSeconds is equal to 10, set it to 0.
TenthSeconds =
TotalTenthSeconds Mod 10
' 10 tenth seconds are equal to 1
second
' int - will give us the integer part of
the number:
' int(0.9) =
0
TotalSeconds = Int(TotalTenthSeconds /
10)
' if the Seconds is equal to 60,
set it to 0
Seconds = TotalSeconds Mod
60
Minutes = Int(TotalSeconds / 60) Mod
60
Hours = Int(TotalSeconds / 3600)
' update the label
Label1 =
Hours & ":" & Minutes & ":" & Seconds & ":" &
TenthSeconds
End Sub