How to make all forms in a project as mdi child of mdi form.
In my winforms I have mdi form. Here I want to make all forms as child of mdi parent.
My forms structure are like this.
MainForm (Mdi parent)
FrmEmployeeDetails(child of MainForm)
FrmNewEmployeeDetails(child of FrmEmployeeDetails)
When I execute the project.form NewEmployeeDetails
is opening outside the MainForm.
For FrmEmployeeDetails
I coded like this.
FrmEmployeeDetails EmployeeDetails= new FrmEmployeeDetails();
EmployeeDetails.MDIparent=this;
EmployeeDetails.show();
FrmNewEmployeeDetails
is child form of FrmEmployeeDetails
.
For the form Fr开发者_StackOverflow中文版mEmployeeDetails
I am creating NewEmployeeDetails
as like this.
FrmNewEmployeeDetails newemployeedetails = new FrmNewEmployeeDetails();
newemployeedetails.show();
How can I make
FrmNewEmployeeDetails
as mdi child ofMainForm
.
Thanks in advance.
you should make this
FrmNewEmployeeDetails newemployeedetails = new FrmNewEmployeeDetails();
// Set the Parent Form of the Child window.
newemployeedetails.MdiParent = this;
// Display the new form.
newemployeedetails.Show();
Change the line
EmployeeDetails.MDIparent=this;
to
EmployeeDetails.MDIparent=this.MdiParent;
精彩评论