In VB.NET, how do I unload all forms within forms and return to parent form? Ah ha, an interesting situation --...
this assumes that the form you want to do this from is in fact within an MDIform. Normal forms can't act as a container towards other forms unless setting the MDIParent property. They also require the parent to have the property 'IsMDIContainer' set to true on the parent.
The following snippet of code should be placed in a procedure somewhere in your code to do what you require.
If Not Me.MdiChildren Is Nothing Then Dim _pointertoForm As System.Windows.Forms.Form For Each _pointertoForm In Me.MdiChildren x.Close() Next End If
Hope that sorts out your little problem.
Related Q&A from Samuel Colak
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.