Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Close

Status
Not open for further replies.

abe6162

Programmer
Sep 7, 2004
24
US
What is the event that controls the close button (the X button on top) on a form. I have an exit button on the form and I want that to behave differently then the close button.
Thanks for you help.
 
The following events are fired in this order:
Unload ? Deactivate ? Close
Only the Unload event may be canceled.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Is there any way to stop the form from closing, if you hit the close button (the X on top of the form)
 
Assuming you have your own close button, you may consider this:
Have a global boolean variable, say bCloseOK
In the Unload event procedure of the form:
Cancel = Not bCloseOK
In the Click event procedure of your own close button:
bCloseOK = True
' your close stuff here

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top