Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
sec.Caption = "00"
min.Caption = "00"
hour.Caption = "00"
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim h, m, s As Integer
sec.Caption = Val(sec.Caption) + 1
If Val(sec.Caption) < 10 Then
sec.Caption = "0" & sec.Caption
End If
If Val(sec.Caption) = 60 Then
min.Caption = Val(min.Caption) + 1
sec.Caption = "00"
If Val(min.Caption) < 10 Then
min.Caption = "0" & min.Caption
End If
End If
If Val(min.Caption) = 60 Then
hour.Caption = Val(hour.Caption) + 1
min.Caption = "00"
If Val(hour.Caption) < 10 Then
hour.Caption = "0" & hour.Caption
End If
End If
End Sub
No comments:
Post a Comment