我想通過Timer和text做個倒計時的程序,到數三秒鐘,但這樣怎麼還是不行啊?請老鳥指定!謝謝!
Private Sub Timer1_Timer()
nTime = Val(InputBox(3))
Timer1.Interval = 3If (nTime < 3) Then
nTime = nTime - 1
Label1.Caption = "請稍後..." & nTime & "秒"
Else
MsgBox ("倒數完畢")
Unload Form1
'停止計時器
Timer1.Interval = 3
End If
End Sub

解决方案 »

  1.   

    Interval 属性是毫秒计算的
      

  2.   

    Private Sub Form_Load()
        nTime=3
        Timer.Interval=1000
        Timer.Enabled=True
    end Sub   Private Sub Timer1_Timer()
        if nTime=0 then 
            Timer1.Enabled=false
            MsgBox ("倒數完畢")
        end if
        Label1.Caption = "請稍後..." & nTime & "秒"
        nTime=nTime-1
    End Sub
      

  3.   

    第一:nTime应定义为全局变量
    第二:Timer1.Interval =1000
      

  4.   

    謝謝wangwei1979
    這裡應該是
        Timer1.Interval=1000
        Timer1.Enabled=True
    ^_^非常感謝你!!