timer
button1 clicktimer1.start
我想搞一个TIMER控件。让它在30秒停止,大家谁知道停止代码怎么写呢,我写的
我在timer tick中写的代码是:
dim dt as timespan
if dt.sencond=30 then
timer1.stop
怎么不对呢?到30秒它也不停啊?
Public a As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Timer1.Interval = 1000 Me.Timer1.Start() End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick a = a + 1 If a = 30 Then Timer1.Stop() MsgBox(a) End If End Sub