vb倒计时牌代码
发布网友
发布时间:2024-10-11 10:37
我来回答
共3个回答
热心网友
时间:2024-11-14 03:09
新建 工程,1个按钮,1个timer,和1个文本框
在文本框内输入时间(秒数),点按钮就开始倒计时了:
Dim i%
Private Sub Command1_Click()
Command1.Caption = IIf(Command1.Caption = "开始计时", "停止计时", "开始计时")
Timer1.Enabled = Not Timer1.Enabled
i = 0
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
Command1.Caption = "开始计时"
Text1 = ""
End Sub
Private Sub Timer1_Timer()
If Text1 = "" Then Exit Sub
Cls
If Val(Text1) - i = 0 Then
Print "时间到!!!"
Timer1.Enabled = False
Exit Sub
End If
Print "现在还剩下" & Val(Text1) - i & "秒了!!"
i = i + 1
End Sub
热心网友
时间:2024-11-14 03:12
开始时间是指.要倒记时的具体分钟?秒?小时?
还是输入当时间到18:39:41的时候叫我?
具体是那个?
热心网友
时间:2024-11-14 03:14
Private Sub form_load()
text1.text = ""
End Sub
private sub command1_click()
timer1.interval = 1000
end sub
Private Sub Timer1_Timer()
text1.text = text1.text - 1
if text1.text = 0 then
unload me
End If
End Sub
倒计时是用label控件显示的。