vb倒计时器代码

2024-12-21 17:05:29
推荐回答(2个)
回答1:

Private Sub Command2_Click()
Timer1.Enabled = True
Timer1.Interval = 1000
shijian = Val(Text1.Text) * 60
Text2.Text = shijian
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
shijian = shijian - 1
Text2.Text = shijian
If shijian = 0 Then
Timer1.Enabled = False
MsgBox "时间到"
End If
End Sub

回答2:

下面有一个不过输入的是秒而不是分钟,别的与你的条件一致。呵呵,你可以去看看,算是个最简单的计时器了