VB 怎样才能使计时器在显示到一定时间就自动关闭

来源:百度知道 编辑:UC知道 时间:2024/07/05 01:55:29
如提。。谁会写代码。。。。
一楼的。。你怎么把主要的没写啊。。。我晕。。我就是想看看那个时间如何指定。。。。汗呢

Private Sub Timer1_Timer()
'指定代码段

'关闭timer1
Timer1.Enabled = False
End Sub

做一个1小时30分钟30秒后关闭的例子。。
放三个Label,一个Timer(timer控件间隔设置为1000)
Private Sub Form_Load()
Label1 = "0"
Label2 = "0"
Label3 = "0"
If Label1.caption=1 and Label2.caption=30 and Label3.caption=0
End
End sub
Private Sub Timer1_Timer()
Label3 = Label3 + 1
If Label3 = 60 Then
Label3 = "0"
Label2 = Label2 + 1
If Label2 = 60 Then
Label2 = "0"
Label1 = Label1 + 1
End If
End If
End Sub