Office like closing childform warning message.


Jose Fernandez


i am creating an application. It's an MDI parent with all the child.

I have been trying using the OnClosing event in every child. It works OK BUT
not the way it should be. The problem is that when i close one child form
individually, it works fine. when i close the mdi parent, it also closes all
the windows BUT

for example.

i have a parent with 5 child.
i close 1 child individually, everything works fine.
i close the mdi parent. (problem) the OnClosing of the main parent,
automatically, call all child OnClosing event. That's ok. But it popups the
4 dialog box for OK, CANCEL one after the other. And what i want is to bring
every childform to front and then popup the dialog box, so the user "see"
the document being closed and then accept or cancel to close it. does it
makes sense? I have tried a couple of tricks by creating an arraylist with
all the forms and then on the Closing event of the main parent iterate but
it doesn't work because by the time my first line of code starts inside the
Closing event, already all the closing events of the child were triggered.

Does anyone knows how to achieve this?

Thank you




You could invoke the closing of the children yourself
in the FormClosing event of the parent. That would give
you control over the closing of the children.

Robin S.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question