Q

In VB.NET, how do I unload all forms within forms and return to parent form?

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.

This was last published in March 2003

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close