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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window Close Button 1

Status
Not open for further replies.

nickperez22

Technical User
Jun 13, 2001
62
US
Is there a way I can block the user from closing the program by using the windows close button in the upper right hand corner of the window? I want the users to only be able to close the program through the close button I have on the form.
 
The technique here is to open a hidden form when the database opens and in that form's unload event test a public variable to see if it is OK to close. If not then set Cancel = true and the database cannot close. You can pop up a message box if you wish, telling the user what to do.

The public variable is set to false in the hidden form's open event and set to true only if the user closes using the Close Database button.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top