vb设定倒计时提醒怎么弄?

2025-01-07 17:55:02
推荐回答(3个)
回答1:

Private Sub Timer1_Timer()
Text3.Text = Format(Time, "ss")
Text2.Text = Format(Time, "mm")
Text1.Text = Format(Time, "hh")
If Text1.Text = 1 And Text2.Text = 3 And Text3.Text = 25 Then MsgBox "时间到了"
End Sub

添加一个时间控件,把这代码直接复制就OK

回答2:

Dim s As Long, i As Long
Private Sub Command1_Click()
s = Val(Text1.Text) * 60 * 60 + Val(Text2.Text) * 60 + Val(Text3.Text)
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
i = i + 1
Me.Caption = s - i
If i >= s Then i = 0: Timer1.Enabled = False: MsgBox "时间到了"
End Sub

回答3:

很简单的程序啊!用timer控件