请问题在vb中我如何才能够做到点一下command按钮发生一个事件,再点一下结束呢?

来源:百度知道 编辑:UC知道 时间:2024/06/17 12:56:39
command按钮当然可以换成其它的东西。
比如我在程序加一个timer控件,我点第一次触发这个事件,我再点一下就结束这个事件,这时候timer控件的enabled属性肯定变成了flase,但是我不知道该怎么做。
我知道的就只有这些,希望那位高手能用简单代码的形式告诉我该怎么实现。

Private Sub timer1_Click()
timer1.enable=not timer1.enable
If timer1.enable=true then
....
Else
timer1.enable=false
End If
End Sub
这样点击一次go,再点stop,再点go...
哥们,记得给分阿。

来个简单点的
Private Sub Command1_Click()

Timer1.Enabled = not timer1.enabled

End Sub

Private Sub Command1_Click()
If Command1.caption = "开始" Then
Timer1.Enabled = true
Command1.caption = "结束"
exit sub
end if
If Command1.caption = "结束" Then
Timer1.Enabled = false
Command1.caption = "开始"
exit sub
End If
End Sub

Private Sub Command1_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub