加一个timer控件timer1.Interval 设置为1000 Private Sub Timer1_Timer() Dim sd As String Dim we As String Text1.Text = Time sd = "15:23:20" If Text1.Text = sd Then we = MsgBox("快关灯了!关机睡觉吧!要不然会弄坏电脑的!!", vbExclamation) Exit Sub End If End Sub
Private Sub Timer1_Timer() Dim sd As String Dim we As String dim TimeNow as time sd=TextTime.text if sd=TimeNow then we = MsgBox("快关灯了!关机睡觉吧!要不然会弄坏电脑的!!",vbExclamation) Exit Sub End If End Sub
同意楼上的 Private Sub Form_Load()'中! Timer1.Interval = 1000 End Sub Private Sub Timer1_Timer() Dim sd As String Dim we As String Text1.Text = Time sd = "15:23:20" If Text1.Text = sd Then we = MsgBox("快关灯了!关机睡觉吧!要不然会弄坏电脑的!!", vbExclamation) Exit Sub End If End Sub
Private Sub Timer1_Timer()
Dim sd As String
Dim we As String
Text1.Text = Time
sd = "15:23:20"
If Text1.Text = sd Then
we = MsgBox("快关灯了!关机睡觉吧!要不然会弄坏电脑的!!", vbExclamation)
Exit Sub
End If
End Sub
如果你用的WIN98,将你做的程序
加入WIN98的计划任务中(在桌面的右下角的系统托盘区中)
——》选择在计算机启动时运行你的程序!
Dim sd As String
Dim we As String
dim TimeNow as time
sd=TextTime.text
if sd=TimeNow then
we = MsgBox("快关灯了!关机睡觉吧!要不然会弄坏电脑的!!",vbExclamation)
Exit Sub
End If
End Sub
Private Sub Form_Load()'中!
Timer1.Interval = 1000
End Sub Private Sub Timer1_Timer()
Dim sd As String
Dim we As String
Text1.Text = Time
sd = "15:23:20"
If Text1.Text = sd Then
we = MsgBox("快关灯了!关机睡觉吧!要不然会弄坏电脑的!!", vbExclamation)
Exit Sub
End If
End Sub