vb.net定时器停止时停止

时间:2017-04-24 06:30:09

标签: vb.net

 Dim aNum As Integer = 0   
 Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            Label1.Text = "Timer: " & aNum
            aNum += 1

            If aNum = 20 Then
                Timer1.Stop()
                MsgBox("timer stopped")
            Else
                MsgBox("not stopped")
            End If
        End Sub

我试图做,如果aNum = 20然后做点什么。但问题是当计时器启动然后Else语句开始工作,直到计时器没有在aNum = 20停止。问题是什么?

0 个答案:

没有答案