程序中用了很多Public数组,下面是结束时的源程序:
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("要结束程序吗?", vbQuestion + vbYesNo + vbDefaultButton2, Me.Caption) <> 7 Then
End
Else
Cancel = 1
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("要结束程序吗?", vbQuestion + vbYesNo + vbDefaultButton2, Me.Caption) <> 7 Then
End
Else
Cancel = 1
End If
End If
End Sub
If MsgBox("确定退出本系统吗?", vbQuestion + vbYesNo, "退出系统") = vbYes Then
For Each Form In Forms
Unload Form
Next Form
End If
你最好 把End 换成 Unload me
set Form = nothing
Dim ExitMsg As String
ExitMsg = MsgBox("退出系统?", vbInformation + vbYesNo, "退出")
If ExitMsg = vbYes Then
Cancel = 0
Else
Cancel = 1
End If
End Sub应该放在QueryUnload事件中