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

Problem with closure of MDI Application 1

Status
Not open for further replies.

ChrisN

Programmer
Jul 9, 2001
59
GB
Hi everyone,

I have an application that uses and MDIForm and a number of child forms.

Is it possible to prevent the controlbox on the MDI from working altogether or at least prevent it from working if a specific criteria is met i.e. a flag is set to true etc.

This is because I would prefer the application to be closed using it's own 'QUIT' command in order to ensure the integrity of any data that may have been written to the system database during a half completed transaction.

Any help with this would be greatly appreciated.

Cheers,
Chris
 
You can use the QueryUnload event of the MDI form to find out what caused the unload event to be fired. If it was the control button on the form [x] then you can cancel the unload. To the user this will appear as though the [x] button does not work.

You could display a message to the efect that the user should use the exit funnction and not the control button within the QueryUnload sub before exiting the sub.

It is all explained in the VB help under QueryUnload.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top