Help - FormClosing event and FormClosed event fires to often
-
Hi all, I have an MDI window with a ButtonBar (defined as master) and from there I can call the child windows (outside the master). And from one child window I am calling an DialogWindow. And here comes the problem: :confused: When I am closing this dialog window, the FormClosing event (of the dialog) fires 34 times, and after that the FormClosed event fires 10 times. I am shure that the events are only initialized for one time. So you can say that 3 layers are opened. (MDI-Master --> MDI-->Slave --> DialogForm) It wouldn't be a problem at all, if the dialog window wouldn't hang up. The whole Program stops. in the FormClosing method is only a quiet simple code.
Dialog_FormClosing(.....)
{
try
{
Console.WriteLine("closing");
if(!can_close)
{
Messagebox.Show("You have to finish your app first");
e.Cancel = true;
}
else
{
e.Cancel = false;
}
}
catch
{
}
}The question is: Why fires the event so often ? And why hangs up the dialog (the dialog does not close) Some ideas ? - using .NET 2.0.xxx Tnx Frank