VB程序倒计时,在text1.text里输入时,在text2.text里输入分,在线等!!!~!!!!
VB程序倒计时,在text1.text里输入时,在text2.text里输入分,点开始按钮开始倒计时,text1.text和text2.text动态显示时间倒计。加一个t...
VB程序倒计时,在text1.text里输入时,在text2.text里输入分,点开始按钮开始倒计时,text1.text和text2.text动态显示时间倒计。
加一个text3.text显示秒 展开
加一个text3.text显示秒 展开
展开全部
Dim hh, mm, ss
Sub Timer1_Timer()
Text3 = IIf(ss < 10, "0" & ss, "" & ss)
Text2 = IIf(mm < 10, "0" & mm, "" & mm)
Text1 = IIf(hh < 10, "0" & hh, "" & hh)
ss = ss - 1
If hh = 0 And mm = 0 And ss = -1 Then
msg = "时间已到,按回车键结束!"
MsgBox msg, 48, "注意"
End If
If ss = -1 And mm > 0 Then mm = mm - 1: ss = 59
If mm = 0 And hh > 0 Then hh = hh - 1: mm = 59
End Sub
Private Sub Command1_Click()
hh = Val(Text1): mm = Val(Text2): ss = Val(Text3)
Timer1.Interval = 1000
End Sub
Sub Timer1_Timer()
Text3 = IIf(ss < 10, "0" & ss, "" & ss)
Text2 = IIf(mm < 10, "0" & mm, "" & mm)
Text1 = IIf(hh < 10, "0" & hh, "" & hh)
ss = ss - 1
If hh = 0 And mm = 0 And ss = -1 Then
msg = "时间已到,按回车键结束!"
MsgBox msg, 48, "注意"
End If
If ss = -1 And mm > 0 Then mm = mm - 1: ss = 59
If mm = 0 And hh > 0 Then hh = hh - 1: mm = 59
End Sub
Private Sub Command1_Click()
hh = Val(Text1): mm = Val(Text2): ss = Val(Text3)
Timer1.Interval = 1000
End Sub
展开全部
Private Sub Command1_Click()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Text3.Text = CStr(CInt(Text3) - 1)
If CInt(Text2.Text) <= 0 Then Text2.Text = "59"
'倒计时到了
If CInt(Text1.Text) = 0 Then
Text2.Text = "0"
Text3.Text = "0"
Timer1.Interval = 0
End If
'秒到了减分
If CInt(Text3.Text) <= 0 Then Text2 = CStr(CInt(Text2.Text) - 1)
'分到了减时
If CInt(Text2.Text) <= 0 Then Text1 = CStr(CInt(Text1.Text) - 1)
'秒到了恢复到59
If CInt(Text3.Text) <= 0 Then Text3 = "59"
End Sub
我测试了。可以。基本上就这个思路,具体的验证什么的你自己加。
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Text3.Text = CStr(CInt(Text3) - 1)
If CInt(Text2.Text) <= 0 Then Text2.Text = "59"
'倒计时到了
If CInt(Text1.Text) = 0 Then
Text2.Text = "0"
Text3.Text = "0"
Timer1.Interval = 0
End If
'秒到了减分
If CInt(Text3.Text) <= 0 Then Text2 = CStr(CInt(Text2.Text) - 1)
'分到了减时
If CInt(Text2.Text) <= 0 Then Text1 = CStr(CInt(Text1.Text) - 1)
'秒到了恢复到59
If CInt(Text3.Text) <= 0 Then Text3 = "59"
End Sub
我测试了。可以。基本上就这个思路,具体的验证什么的你自己加。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询