Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > How to close mdi child form...
 

How to close mdi child form...

Hello all,
I am using visual studio 2008.
i have a mdi parent form in which i am loading child forms.
When 1 form loads i want previous form should close.
I am using menu bar to load forms in my program.
I tried the following code

Dim frm As Form
For Each frm In Forms
If frm.Name <> "frmMenu"
Then Unload(Me)
End If
Next

it gives me copilation error on Forms
Error msg - "name Forms is not declared"
frmMenu is my parent forms name.

please help me.....
fireblade123  Thursday, February 26, 2009 6:46 PM
For Each frm As Form In me.MdiChildren
If frm.Name <> "frmMenu"Then frm.Close
End If
Next

Ewald - Please remember to mark the replies as answers if they help.
  • Marked As Answer byfireblade123 Friday, February 27, 2009 4:40 PM
  •  
Ewald Hofman - Avanade  Thursday, February 26, 2009 8:20 PM
For Each frm As Form In me.MdiChildren
If frm.Name <> "frmMenu"Then frm.Close
End If
Next

Ewald - Please remember to mark the replies as answers if they help.
  • Marked As Answer byfireblade123 Friday, February 27, 2009 4:40 PM
  •  
Ewald Hofman - Avanade  Thursday, February 26, 2009 8:20 PM

You can use google to search for other answers

Custom Search

More Threads

• Combobox
• Can BindingSource.Filter string strings to integers in order to do range comparisons?
• I've a problem in reading the exact value of a checkboxcell in datagridview.
• Bindable Attribute problem
• Adding image to DatagridViewCells
• Hi there, can someone help out the help_out_guy1, regarding the "bindingnavigator" ?
• BindingContext.Position will not advance to new row in form
• DataMember property ' ' cannot be found on the DataSource
• Change the layout of a dataView (or similar)? I.e. display down not accross
• Inserting Values to SQL from Textbox