读书人

VB新手!老!该怎么解决

发布时间: 2012-01-24 23:11:54 作者: rapoo

VB新手!老!
我想通Timer和text做倒的程序,到三秒,但怎是不行啊?老指定!!
Private Sub Timer1_Timer()
nTime = Val(InputBox(3))
Timer1.Interval = 3

If (nTime < 3) Then
nTime = nTime - 1
Label1.Caption = "稍後... " & nTime & "秒 "
Else
MsgBox ( "倒完 ")
Unload Form1
'停止器
Timer1.Interval = 3
End If
End Sub

[解决办法]
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

[解决办法]
第一:nTime应定义为全局变量
第二:Timer1.Interval =1000

[解决办法]
点管理给分

读书人网 >VB

热点推荐