Form doesn't open on MDI Form

Posted by Naraayanan under C# on 5/25/2013 | Points: 10 | Views : 1032 | Status : [Member] | Replies : 1
Hi All,
This is my Scenario. In my Application, I have MDI Form, Form1 and Form2. These two forms opened on the MDI Form. I called that form from the MDI Menu. First I opened Form1 on the MDI Form . Datagridview is on the Form1. when I double clicked the datagridview , Form2 should show on the MDI . This is my Code,

On MDI Menu Bar
Form1 frm = new Form1();
frm.MdiParent = this;
frm.WindowState = FormWindowState.Maximized;
frm.Show();


Form2 frm1 = new Form2();
frm1.MdiParent = this;
frm1.WindowState = FormWindowState.Maximized;

frm1.Show();


private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
MDIParent1 mdi = new MDIParent1();
Form2 frm = new Form2();
frm.MdiParent = mdi;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
}


But Form2 doesn't open on the MDI Form. Please let me know where is this problem? and how can i solve this issue?

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



Responses

Posted by: Praks on: 6/3/2013 [Member] Starter | Points: 25

Up
0
Down
MDIParent1 mdi = new MDIParent1();

Form2 frm = new Form2();

frm.MdiParent = mdi.MDIParent;

frm.WindowState = FormWindowState.Maximized;

frm.Show();

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

Login to post response