我正在尝试将倒数计时器放入我的程序中,但是当我运行程序时,它不会倒计时.它跳到一个,就是这样. Private Sub CompactTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompactTim
Private Sub CompactTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompactTimer.Tick Dim Time As Integer = 11 Do Until Time = 0 ClockLabel.Text = "Compacting database in: " & Time Time -= 1 Loop End Sub
我也启动了计时器并在Form_Load routuine中将间隔声明为500.
摆脱循环并在范围外声明Time变量.Dim Time As Integer = 11 Private Sub CompactTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) _ Handles CompactTimer.Tick If Time >= 0 Then ClockLabel.Text = "Compacting database in: " & Time Time -= 1 Else CompactTimer.Stop End If End Sub