Hello.
I may have missed something simple here but I want to know that when a form is closed whether it was closed when the X is clicked.
How is this achieved?
What I do is when the user selects a "close" button (not the X button), I
set a boolean variable. That way if it is set, I know they did not click
the X but instead clicked the close button. If they clicked the X, the
boolean is not set.
In the form_closing event:
Private bCloseButtonClicked As Boolean
Public Sub Form_Closing(...)
If bCloseButtonClicked then
MsgBox("Closing from close button")
Else
MsgBox("Closing from clicking the X button")
End IF
End Sub
Public Sub Close_Button_Click(...)
bCloseButtonClicked = True
End Sub
This is a workaround but it can work reliably. You may also be able to
intecept the windows messages in the WndProc override and determine it that
way.
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.