标签:
j简单的定时提醒程序。
Dim a As Integer //声明了三个变量来记录当前当前时间,后来发现没什么用啊……
Dim b As Integer
Dim c As Integer
Private Sub Command2_Click() //用来关闭时钟事件
Command1.Enabled = True //设置按钮一的可用为真
Timer1.Interval = 0
Label8.Caption = ""
End Sub
Private Sub Timer1_Timer() //时钟事件,每秒都取当前小时数,分钟数,秒数。然后减去指定的时间。若等于零就提示时间到了。
a = Hour(Now)
b = Minute(Now)
c = Second(Now)
Dim aa As Integer
Dim bb As Integer
Dim cc As Integer
aa = Val(Text1.Text) - Hour(Now)
bb = Val(Text2.Text) - Minute(Now)
cc = Val(Text3.Text) - Second(Now)
Label8.Caption = Format(aa) + ":" + Format(bb) + ":" + Format(cc)
If cc = 0 And bb = 0 And aa = 0 Then
MsgBox "时间到!"
Label8.Caption = ""
End If
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Or Val(Text1.Text) > 24 Then
MsgBox "小时输入错误!"
ElseIf Text2.Text = "" Or Val(Text2.Text) > 60 Then
MsgBox "分钟输入错误!"
ElseIf Text3.Text = "" Or Val(Text3.Text) > 60 Then
MsgBox "秒输入错误!"
Else
Timer1.Interval = 1000
Command1.Enabled = False //用来启动时钟事件
End If
End Sub
Private Sub Timer2_Timer() //用来设置当前时间
Label6.Caption = Format(Time)
End Sub
标签:
原文地址:http://www.cnblogs.com/xiaoqi520/p/5562147.html