怎么用VB 命令按钮,timer 实现连续执行一个程序。给些代码和解释!谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/24 14:13:37

先把timer控件的enableb属性设置为false
再在
Private Sub Timer1_Timer()

End Sub
里填写需要执行的程序
如:
声明变量:dim a
Private Sub Timer1_Timer()
a=a+1
text1.text=a
End Sub
在添加一个命令按钮
代码为:
Private Sub Command1_Click()
timer1.enableb = true
End Sub

连续执行?用一个程序不停的调用另一个啊?

那就把Timer的Interval属性设置为非零的数,在过程里写上
Private Sub Timer1_Timer()
shell 你想要调用的程序的路径
End Sub

按钮控制Timer的启动和停止
Private Sub Command1_Click()
Timer1.Enabled=not Timer1.Enabled
End Sub

是不是想要这个啊?

重要属性:
interval 1000 '1秒出发一次time事件