vb timer重复计时

来源:百度知道 编辑:UC知道 时间:2024/06/05 17:45:10
Dim sum As Integer
Private Sub Form_Load()
Timer1.Interval = 1000
sum = 30

End Sub

Private Sub Timer1_Timer()
Timer1 = Now
Text1.Text = Time

sum = sum - 1
Text2.Text = sum
If sum <= 0 Then
Timer1.Enabled = False
End If
End Sub
这是我编的一个程序 有30s的倒计时 能不能倒计时到了不停止 重新从30S开始倒计时

Dim sum As Integer
Private Sub Form_Load()
Timer1.Interval = 1000
sum = 30

End Sub

Private Sub Timer1_Timer()
Timer1 = Now
Text1.Text = Time

sum = sum - 1
Text2.Text = sum
If sum <= 0 Then
sum = 30

End If
End Sub

Private Sub Timer1_Timer()
Timer1 = Now
Text1.Text = Time

sum = sum - 1
Text2.Text = sum
If sum <= 0 Then
sum=30
End If
End Sub
不过不清楚你这样设置30秒还有什么用!