|
|
Title | See why a form is closing |
Keywords | close, unload, QueryUnload, UnloadMode, closing |
Categories | Tips and Tricks |
|
|
In the QueryUnload event handler, use the UnloadMode parameter to see why the form is unloading.
|
|
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode _
As Integer)
Select Case UnloadMode
Case vbFormControlMenu
MsgBox Caption & ": Close command from Control " & _
"menu or X button."
Case vbFormCode
MsgBox Caption & ": Unload statement from code."
Case vbAppWindows
MsgBox Caption & ": Windows session ending."
Case vbAppTaskManager
MsgBox Caption & ": Task Manager close."
Case vbFormMDIForm
MsgBox Caption & ": MDI parent is closing."
Case vbFormOwner
MsgBox Caption & ": Owner is closing."
End Select
End Sub
|
|
|
|
|
|