MDI
-
Hi, I have the following code, Form MDIChild = new Form1(); mdiChild.MdiParent = this; not sure what this does MDIChild.Show(); When i run the code with line 2 it gives me the error message "namespace mdichild can not be found" However if i comment out line 2,it works fine. I am not sure what line 2 does. Please can someone explain,and also explain how i should fix this. Thanks
-
Hi, I have the following code, Form MDIChild = new Form1(); mdiChild.MdiParent = this; not sure what this does MDIChild.Show(); When i run the code with line 2 it gives me the error message "namespace mdichild can not be found" However if i comment out line 2,it works fine. I am not sure what line 2 does. Please can someone explain,and also explain how i should fix this. Thanks
Anonymous wrote: mdiChild.MdiParent = this; try changing this to
MDIChild.MdiParent = this;
HTH, cheers :) Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net -
Hi, I have the following code, Form MDIChild = new Form1(); mdiChild.MdiParent = this; not sure what this does MDIChild.Show(); When i run the code with line 2 it gives me the error message "namespace mdichild can not be found" However if i comment out line 2,it works fine. I am not sure what line 2 does. Please can someone explain,and also explain how i should fix this. Thanks
what it should do (if you change the mdiChild to it's correct name MDIChild) is assign the current form as mdiparrent to the MDIChild form. maybe the names confuse you. here is a better example:
Form P = new Form(); Form C = new Form(); P.IsMdiContainer = true; //alows the form to contain MdiChilds C.MdiParent = P; //states that C is a MdiChild of P P.Show(); C.Show();
bare in mind that once a from is a mdiChild it cannot be a MdiParent as well(as in you can't have a mdi form inside an mdiform). In the above example if you set C.IsMdiContainer = true; an exception will be raised. -
what it should do (if you change the mdiChild to it's correct name MDIChild) is assign the current form as mdiparrent to the MDIChild form. maybe the names confuse you. here is a better example:
Form P = new Form(); Form C = new Form(); P.IsMdiContainer = true; //alows the form to contain MdiChilds C.MdiParent = P; //states that C is a MdiChild of P P.Show(); C.Show();
bare in mind that once a from is a mdiChild it cannot be a MdiParent as well(as in you can't have a mdi form inside an mdiform). In the above example if you set C.IsMdiContainer = true; an exception will be raised.