0

I would like to store some data about open MdiChildren to restore them when the application restarts.

But the MdiChildren property seems to empty on the ApplicationExit event.

Which event do I listen to to be able to get a list of open MdiChildren when user closes the main window?

nunespascal
  • 17,584
  • 2
  • 43
  • 46

1 Answers1

1

try following code. It works for me. you can put additional loginc in If to check if any child window is visible ot not and if not then don't ask any question.

private void MDIParent1_FormClosing(object sender,
FormClosingEventArgs e)
{
if (MessageBox.Show("Close?",
AppDomain.CurrentDomain.ToString(), MessageBoxButtons.YesNo) ==
DialogResult.No)
{
e.Cancel = true;
}
}
Romil Kumar Jain
  • 20,239
  • 9
  • 63
  • 92
  • Thanks. FormClosed is called before ApplicationExit, and the children are available on on the parent form closed event. – nunespascal May 24 '12 at 08:23