初学者请教,谢谢啦!
Dim pretime As Integer, mm As Integer, ss As Integer
Private Sub CmdStart_Click()
CmdStart.Enabled = False
Timer1.Enabled = True
pretime = Val(InputBox("请输入倒计的时间?"))
mm = pretime / 60
ss = pretime Mod 60
Label1.Caption = Str(mm) & "分" & Str(ss) & "秒"
End Sub
Private Sub Timer1_Timer()
mm = pretime / 60
ss = pretime Mod 60
Label1.Caption = Str(mm) & "分" & Str(ss) & "秒"
If mm = 0 And ss = 0 Then
Label1.Caption = "时间到"
Timer1.Enabled = False
CmdStart.Enabled = True
End If
pretime = pretime - 1
End Sub
为什么运行后,好像是多计了1分钟。