I have .net 1.1 WinForms MDI application.
I need to close all MDI child forms.
I tried
private void CloseAllForms_Click(object sender, System.EventArgs e){
foreach (Control c in this.Controls) {
if (c is MdiClient)
((Form)c).Close();
}
}
but got error
"Unable to cast object of type 'System.Windows.Forms.MdiClient' to type 'System.Windows.Forms.Form'."
Why ?
I also tried c.FindForm().Close();
but this closes whole application.
Andrus