views:

433

answers:

2

I know using the follwing two methods for showing a form in another form

method1

public Form1()
{
    InitializeComponent();

    Form2 embeddedForm = new Form2();
    embeddedForm.TopLevel = false;
    Controls.Add(embeddedForm);
    embeddedForm.Show();
}

method 2

Form1 fChild = new Form1();
fChild.MdiParent = this;
fChild.Show();

i need to learn how to display this child form in a panel of the parent form

or if somebody can tell me how to set the x,y coordinates of the child form

+1  A: 

You can change the parent of the form at any time, e.g.:

fChild.TopLevel = false;
fChild.Parent = fParent.panel1;
Bernhof
A: 
Form2 child = new Form2();
child.TopLevel = false;
child.Parent = this.panel1;
child.Show();
adatapost