Only close when Message Box result allows it

sjn78

Junior Contributor
Joined
May 4, 2003
Messages
255
Location
Australia
My program loads forms into the main form of the application. These forms are loaded from Class Library projects.

The forms in the DLL's have text boxes on them so, in the closing event I do a check to see if any values differ from the database and then put up a message box to give the user a chance to save. It works fine when I close the DLL form.

Problem I am having is when you close the app using the close icon on the main form, it disregards the DLL forms closing event and closes the whole thing.

How can I intercept this? Since I can't set a value back to the main app using a dll (or can I?) without using proper plugin design.
 
Can you not use the Closing event of the main form to manual close each child form. Obivously this will only work if you can reference the 'child' forms. Assuming you are creating the 'child' forms from the main form in the first place it should be easy enough to create an array of them.
 
Back
Top