关于VB计时器TIMER的问题

2024-11-07 10:47:26
推荐回答(1个)
回答(1):

Dim i As Integer
Dim a As Integer
Dim b As Integer

Private Sub Label1_Click()
Label1.Caption = Time
Timer1.Enabled = True
End Sub

Private Sub Label2_Click()
Label2.Caption = Time
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
i = i + 1
If i >= 60 Then
a = a + 1
i = 0
End If
If a >= 60 Then
b = b + 1
End If
Label3.Caption = b & ":" & a & ":" & i
End Sub
注:timer1.enable=false
timer1.interval=1000