谁能让这个程序立刻关闭

fuanwei 2005-03-02 04:56:48
谁能让这个程序立刻关闭
Private Sub Command1_Click()
Unload Me '这里如果是end就立刻关闭窗体了
End Sub

Private Sub Timer1_Timer()
Dim i As Long
For i = 1 To 1000
Label1.Caption = i
Delay 10
Next
End Sub
Public Sub Delay(mSec As Long)
On Error GoTo ShowErr

Dim TStart As Single

TStart = Timer

While (Timer - TStart) < (mSec / 1000)
DoEvents
Wend
Exit Sub
ShowErr:
MsgBox Err.Source & "------" & Err.Description
Exit Sub

End Sub
...全文
108 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
VBDN 2005-03-16
  • 打赏
  • 举报
回复
关注!
VBDN 2005-03-02
  • 打赏
  • 举报
回复
'加一指示变量RunEnabled

Private RunEnabled As Boolean
Private Sub Command1_Click()
RunEnabled = False
End Sub

Private Sub Form_Load()
RunEnabled = True
End Sub

Private Sub Timer1_Timer()
Dim i As Long
For i = 1 To 1000
If RunEnabled Then
Label1.Caption = i
Delay 100
End If
Next
End Sub
Public Sub Delay(mSec As Long)
On Error GoTo ShowErr

Dim TStart As Single
Debug.Print ".";
TStart = Timer
While (Timer - TStart) < (mSec / 1000)
DoEvents
Wend
Exit Sub
ShowErr:
MsgBox Err.Source & "------" & Err.Description
Exit Sub

End Sub
VBDN 2005-03-02
  • 打赏
  • 举报
回复
高难度!
熊孩子开学喽 2005-03-02
  • 打赏
  • 举报
回复
你到底是要立即关闭还是不要立即关闭阿,立即关闭用END就可以了.
AprilSong 2005-03-02
  • 打赏
  • 举报
回复
或者TerminateProcess
或者这样…… - -b

Private Sub Form_Unload(Cancel As Integer)
End
End Sub
fuanwei 2005-03-02
  • 打赏
  • 举报
回复
?

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧