怎么写倒计时器?
各位大哥,我刚开始学习VB。想做一个倒计时器,用计时器怎么写?望指教
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Text1.Text = 10
Command1.Caption = "倒计时开始"
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
If Text1.Text = 0 Then
Text1.Text = 10
Me.Caption = "时间到!"
Timer1.Enabled = False
Else
Text1.Text = Val(Text1.Text) - 1
End If
End Sub