468,770 Members | 2,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,770 developers. It's quick & easy.

stop a MDI child form from closing if parent is trying to close

I have a form that is presented in an mdi child window. If the user hits
exit or the X button on the titlebar of the mdi child form, that form's
"closing" event fires and in that event I check to see if there are any
outstanding database changes that have not been saved. If there are I give
the user the option of abandoning the closing of the form by issuing a
"e.cancel" statement. This works perfectly if the user hits the X in the
titlebar of the MDI child form, but if the user hits the X in the titlebar
of the MDI parent form then the "e.cancel" has no effect and the form closed
anyway.

Is there a way to cancel a form close of a mdi parent form from within the
mdi child form?

thanks, John
Dec 17 '05 #1
1 2091
John,

You can check if there are existing MDI childs in the close event of the
parent.

if Me.mdichildren.lenght > 0 then
e.cancel etc.

You can as well get the specific one. You have than to loop through it and
check its name.

I hope this helps,

Cor
Dec 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by zobie | last post: by
2 posts views Thread by Jon | last post: by
3 posts views Thread by =?Utf-8?B?RGF2ZVA=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.