mdi form wont open in mdi

banks

Well-known member
Joined
Sep 7, 2005
Messages
50
Programming Experience
Beginner
hi,

i am trying to develop an mdi style system so that one parent form holds all child forms. I think i have set up the mdi form correctly, but i cant get some forms to open inside the mdi.

for instance i have a main menu form that does open in the mdi, which has buttons on it which i want to link to other pages. with the code below i have placed on the buttons, the form opens a new window.

VB.NET:
Expand Collapse Copy
    Private Sub btnRaiseCar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRaiseCar.Click
        Dim frmCar As New frmCar
        With frmCar
            .Text = "Child " & Me.MdiChildren.GetLength(0)
            .WindowState = FormWindowState.Normal
            .ControlBox = True
            .Show()

        End With
    End Sub

i think i may be missing some code assigning the mdiarent but am unsure - the mdi parent form is called mdiCAR.

Thanks, alex
 
As you probably call the frmCar form from the mdiCAR form you should point out that mdiparent of certain child form is actually mdiCAR. Means,
VB.NET:
Expand Collapse Copy
[COLOR=blue]With[/COLOR] frmCar
[COLOR=green]{...}[/COLOR]
.MdiParent = [COLOR=blue]Me[/COLOR] [COLOR=green]'this may be that if you call frmCar from another child form to change to: .MdiParent = Me.MdiParent[/COLOR]
.Show()
[COLOR=blue]End With[/COLOR]
Regards ;)
 
Back
Top