pc塑料粒子 怎么来的:怎么用vbtimer控件编个定时器

来源:百度文库 编辑:高校问答 时间:2024/05/10 11:29:37
哪位大哥帮帮我啊

先在窗体上放一个按钮,一个文本框,一个Timer控件

Dim timeLost As Integer

Private Sub Form_Load()
Timer1.Interval = 1000
timer1.Enabled =False '初始定时器为关闭状态
End Sub

Private Sub Command1_Click()'点击按钮激活记时器
timeLost = Text1.Text '设定时间(倒记时时间 秒)
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
timeLost = timeLost - 1
If timeLost <= 0 Then
Timer1.Enabled = False
'到时触发的动作,可以是自定义函数或过程,或打开应用程序,或调用系统过程
Shell "c:\windows\system32\notepad.exe"
End If
End Sub

Timer本身就是定时器呀。。。
不知你想怎么用。。