VB中关于static的疑惑

来源:百度知道 编辑:UC知道 时间:2024/05/04 07:32:38
请问一下,以下程序为什么不能每秒钟输出一个点而永远都只是一个点呢?
希望路过的朋友帮帮我~谢谢!
Private Sub Form_Load()
Static lab1Caption As String
lab1Caption = "."
Label1.Caption = "正在连接游戏服务器,请稍候"
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
If Dir("f:\netgame", vbDirectory) <> "" Then
Shell "c:\windows\explorer.exe" & " f:\netgame", vbMaximizedFocus
Else
lab1Caption = lab1Caption & "."
Label1.Caption = "正在连接游戏服务器,请稍候" & lab1Caption
End If
If lab1Caption = "...." Then lab1Caption = "."
End Sub
1和3楼朋友的回答也是对的,不过VB妮可朋友的答案更好,希望你们能再帮我解决一下:
http://zhidao.baidu.com/question/45907720.html
谢谢!

呵呵,想让它增加点, 你看看我的代码:

Dim i%

Private Sub Form_Load()
Label1.Caption = "正在连接游戏服务器,请稍候"
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
If Dir("f:\netgame", vbDirectory) <> "" Then
Shell "c:\windows\explorer.exe" & " f:\netgame", vbMaximizedFocus
Else
i = i Mod 4 + 1
Label1.Caption = "正在连接游戏服务器,请稍候" & String(i, 46)
End If
End Sub

方法1:Static lab1Caption As String 语句放Timer1_Timer事件内
Private Sub Form_Load()
Label1.Caption = "正在连接游戏服务器,请稍候"
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Static lab1Caption As String
If Dir("f:\netgame", vbDirectory) <> "" Then
Shell "c:\windows\explorer.exe" & " f:\netgame", vbMaximizedFocus
Else
lab1Caption = lab1