hey guys,

I have this simple set a codes that opens a form as a child in MDI container.

Private Sub BarButtonItem1_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick

        frmConfirmShipment.MdiParent = Me
        frmConfirmShipment.Show()

        ''Dim NewMDIChild As New frmConfirmShipment() With {.MdiParent = Me}
        ''For Each ChildForm As Form In Me.MdiChildren
        ''If ChildForm.Name = NewMDIChild.Name Then
        ''ChildForm.Focus()
        ''Exit Sub
        ''End If
        ''Next
        ''NewMDIChild.Show()
    End Sub

When i run this set of codes, system keep telling me that same form cannot be both mdichild and mdiparent, however, I never set my child form as a parent.
Someone please help~!

This is the exact error message

Form cannot be both an MDI child and MDI parent.
Parameter name: value

You set the form to be MDI parent in your code and you still expect it to open in itself.

You set the form to be MDI parent in your code and you still expect it to open in itself.

what do you mean? I've been trying to figure this our all day and am very frustrated so please bare with me.
I don't know that you mean by 'open in itself'

I am trying to open a form called frmConfirmShipment from frmMain which is the MDI parent for all of my other forms. I have about 14 other forms that opens in MDI container without any problem but this one would keep giving me error message.

This question has already been answered. Start a new discussion instead.