VB的Timer控件的计时求助

来源:百度知道 编辑:UC知道 时间:2024/06/03 15:34:40
是这样滴,假设今天是2008年12月13日,我获取了一个变量t值为2008-12-13 10:59:51,并且我想让变量newt在t变量上加上两小时,也就是为2008-12-13 12:59:51,请写出VB的相关代码,谢谢啦!
谢谢啦。请问怎么样让时间到了后运行记事本程序勒?帮忙写下代码吧,嘿嘿

Private Sub Command1_Click()
Dim t
t = Now
newt = t + #2:00:00 AM#
Text2.Text = newt
Shell "notepad.exe", 1
End Sub

Private Sub Form_Load()
Text1.Text = Now
End Sub

Private Sub Timer1_Timer()
Static t As Long
If t > 120 * 60 Then
Shell "notepad.exe", 1
Timer1.Enabled = False
Else
t = t + 1
End If

End Sub

这是代码,要加1个commandbutton,1个timer,2个textbox控件的,还有timer控件的intervel属性值要改为1000啊!别忘了!120分钟后,就会自动调用记事本的哦!

vb好像有个专门的函数是加时间用的
你自己找找看
====================

怎么样让时间到了后运行记事本程序

用timer控件一直监视时间

newt = t + #2:00:00#