I want to open an Instance of a form in MDI Container

here is my code
I just want an instance of a form to Edit records in the database

Private Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click
        Dim Emp As New Employee()

        Emp.MdiParent = Me
        Emp.Show()


    End Sub

I'm getting this error when I click on Edit button

Form that was specified to be the MdiParent for this form is not an MdiContainer. Parameter name: value

I want the new form to open inside the MDI container

In the properties of the MdiParent look for IsMdiContainer and set that to true.

as you can see in the screen shot my ISMdiContainer is set true

MDI

Did you start the form as an MDI Parent Form? I'm not sure of everything that's required to make a form an MDI Parent but I suspect that there is an obscure property that is required. Using the standard template and modifying it might bring better results.

The screenshot I provided with the properties is the parent MDI form ,and inside Employee form I have a button EDIT(for editing recored)I have put the above code in that and I want the new window to open inside the parent MDI form

How can I do that?

assign mainform as the parent for the new form and use the show method

NewForm.MDIParent = MainForm
NewForm.Show()

Thank you "tinstaafl" one hurdal clear ,many more to go.:)

As I said now again a new hurdal >>>

Private Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click
        Dim Emp As New Employee()
        Emp.MdiParent = Mainfrm
        Emp.Show()
        DGVload1()
        BtnEdit.Text = "new edit"
    End Sub

Now I want to make a new button on the instance form ,because whenever I click on the edit button (Old button)new form is opened.I want a button where I can edit content in the tables .

Are you talking about a button in the toolbar or on the form?

on the new form

You can easily add it in the design window, then double-click it and the code stub will show. Add your code in there. If you want it in a toolbar, just add one to the mdi child the same as you added for the mdi parent

Form that was specified to be the MdiParent for this form is not an MdiContainer.
Parameter name: value

i got this error how can i solve it please help me

Set the IsMdiContainer property to True on your parent form.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.