to show MDI child form into panel 2 of split container

Posted by Vish2012 under C# on 5/7/2012 | Points: 10 | Views : 23864 | Status : [Member] | Replies : 3
How to show MDI child form into panel 2 of split container.
For eg : Whenever i wil click link button from panel 1 the form should open in panel 2 of split container.

I tried this code


private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)

{

Form f1 = new Form();



SetParent(f1.Handle, splitContainer1.Panel2.Handle);

f1.Show();
}

But the form is opening in the outside window.

So pls help.....

Thanks in Advance....




Responses

Posted by: Naraayanan on: 5/7/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
try this code...

 

private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)

{
Form2 f1 = new Form2 ();
f1.TopLevel = false;
this.splitContainer1.Panel2.Controls.Add(f1);
f1.Show();
}


Note: You can show a Form in the Panel.But not MDIForm .Because it is a Parent form.

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Vish2012, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naraayanan on: 5/7/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Check this link
http://stackoverflow.com/questions/4230486/splitcontainers-panel-as-the-mdi-parent-for-other-forms

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Vish2012, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vish2012 on: 5/7/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks Sir... It works...

Vish2012, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response