注册 登录
编程论坛 VB6论坛

求大家帮忙,用vb做一个倒计时器为什么会溢出?

想飞木 发布于 2013-03-05 13:57, 410 次点击
Option Explicit
Dim n As Long
Dim dt As Date
Dim date1 As Date
Dim date2 As Date
Private Sub Command1_Click()
Timer1.Enabled = True
date1 = Time
date2 = Format(Text1.Text, "hh:mm:ss")
dt = date1 + date2

End Sub

Private Sub Form_Load()
Text1.Text = "00:01:00"
End Sub



Private Sub Timer1_Timer()
n = DateDiff("s", Time, dt)
Label1 = Format(TimeSerial(0, 0, n), "hh:mm:ss")
If n = 0 Then End
End Sub
3 回复
#2
曾大虾2013-03-05 17:41
其它不变,修改以下:
Private Sub Form_Load()
Text1.Text = "00:01:00"
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
#3
想飞木2013-03-12 20:44
可以了,谢谢你啦
#4
qq8719281762013-03-20 13:34
开关的问题,还有你没有设置1000毫秒。
1