vb 整点提醒程序

来源:百度知道 编辑:UC知道 时间:2024/05/16 07:37:00
我用三个TEXT控件分别输入 年 月 日 用一个Label1显示现在系统时间
我想实现的是在我设定的日期内一的到整点就提醒~~
下面是我的程序~~
Private Sub Command1_Click()
If Left(Year(Date), 4) = Text1 Then
If Left(Month(Date), 6, 2) = Text2 Then
If Left(Day(Date), 8, 2) = Text3 Then
If Right(Label1, 5) = "00:00" Then
MsgBox ("你该休息了")
End If
End If
End If
End If
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Now()
End Sub
请高手指点指点 谢谢了~~
Private Sub Command1_Click()
If Left(Year(Date$), 4) = Text1 And Left(Month(Date$), 6, 2) = Text2 And Left(Day(Date$), 8, 2) = Text3 And Right(Label1, 8) = "00:00:00" Then
MsgBox ("你该休息了")
End If
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Now()
End Sub
为什么运行的时候这个程序总是提示我错误的参数号或无效的属性赋值~~这个应该怎么解决???

Private Sub Command1_Click()
If Left(Year(Date$), 4) = Text1 And Left(Month(Date$), 6, 2) = Text2 And Left(Day(Date$), 8, 2) = Text3 And Right(Label1, 8) = "00:00:00" Then
MsgBox ("你该休息了")
End If
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Now()
End Sub

一点小建议:
在定时器代码中,用TIME取得时间,并变成字符型,再整型为00:00:00的格式,方便后面判断。