MDI .... i dont want 100 windows HELP...

iinfi

New member
Joined
Jun 5, 2005
Messages
3
Location
India
Programming Experience
1-3
after i click a menu item in a MDI container i have made a form open inside the MDI container. on

clicking a button in the new form or the MDI container i want a new form (maximised) to open in

the same MDI Container and the previous form to close. the new Form always opens when i try

but the previous form does not close. how do i implement this?

Form2 newMDIChild1 = new Form2();
newMDIChild1.MdiParent = Form1();
newMDIChild1.Show();



Also in any Form if i have a button and on its click if make a new form open, the new form opens

but the old form does not close. i want the old form to close and the new form to be displayed.

how do i do this.
 
You will have to close that instance of the form Object.

I have not done this, but I believe that there is a form collection that can be looped through and then you could close any child form before showing the new form.
 
Re:

form1 is mdiContainer

VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim form2 As Form2
        form2.MdiParent = Me
        form2.Show()
    End Sub

button on form2 ,opens form3
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim form3 As New Form3()
        form3.MdiParent = Me.MdiParent
        Me.Close()
    End Sub
 
Back
Top