I have a MDI window application, before closing the main form I first check to see if there is any child form opened, if so then the main form doesn't close. It is working fine except that some times (I don't know exactly when) after opening and closing any child forms there is still one form in OwnedForms, when I see the details of OwnedForms[0].Value it shows something like this: {Infragistics.Win.ToolTipFormEx, Text: }. There is not opened any form except that one and it is not visible to the user, so the main form doesn't close. Any idea? Here is the code I use to check before closing the main form. I apologize if this is not the right forum but I don't know wich one to use for this.
private void MainForm_Closing( object sender, System.ComponentModel.CancelEventArgs e ){ if( this.OwnedForms.Length > 0 ) { e.Cancel = true; } }
ToolTipFormEx is the form that is used to display Infragistics Tooltips from ToolTipManager or some other Infragistics control on the form. This form is not an MDI child and should only be in the OwnedForms collection which it is displayed. So perhaps you have a tooltip displayed when you are clicking the close button on the form.
It sounds to me like the simplest thing to do would be to simply ignore forms of that type - or perhaps any form that does not have an MDIParent.
Hi Mike,
I got the same problem but in a different way.
We got our main form and two subForm's opened by it. Subform1 produces no errors, but SubForm2.
Before open any subForm, our Application.OpenForms shows following hierarchy: MainFormTitle (Type:FormMain) [ONLY 1 item is present].
After open Subform1, our Application.OpenForms shows following hierarchy: MainFormTitle (Type:FormMain), SubForm1Title (Type:SubForm).
After closing SubForm1, our Application.OpenForms shows following correct hierarchy again: MainFormTitle (Type:FormMain) [ONLY 1 item is present].
After open Subform2, our Application.OpenForms shows following hierarchy: MainFormTitle (Type:FormMain), "" (Type:Infragistics.Win.TooltipFormEx), SubForm2Title (Type:SubForm).
After closing SubForm2, our Application.OpenForms shows following incorrect hierarchy again: MainFormTitle (Type:FormMain), "" (Type:Infragistics.Win.TooltipFormEx)
Because we get now an incorrect OpenForms hierarchy, our MainForm disappears into the background behind all other opened application windows (if any present).
This happens only if Infragistics.Win.TooltipFormEx is contained in the list.
Yes, currently we're using an TooltipManager for subForm2 and we can not remove it.
But it isn't acceptable for us that our mainForm moves into background every time we're showing (better closing) an form that includes an tooltipManager! And removing all tooltipManager from forms isn't a solution ;)
Any idea here? We expected the normal behavior here....open a Form from MainForm -> show subform -> close subForm -> show mainForm again