private void swichPanelForm(string btnClicked) { Form[] formArray = new Form[6]; formArray[0] = new frmDashboard(); formArray[1] = new frmProject(); formArray[2] = new frmTimeSheet(); formArray[3] = new frmStaffMembers(); formArray[4] = new frmExpenses(); formArray[5] = new frmReports(); for (int i = 0; i < formArray.Length; i++) { if (formArray[i].Name == btnClicked) { formArray[i].MdiParent = this; formArray[i].Dock = DockStyle.Fill; formsPanel.Controls.Clear(); FormProject.TopLevel = false; formsPanel.Controls.Add(formArray[i]); formArray[i].Show(); } } }
private void btnProjects_Click(object sender, EventArgs e) { frmProject project = new frmProject(); project.Show(); Hide(); /* * if (formProject == null) * { * formProject = new frmProject(); //Create form if not created * //formProject.FormClosed += formProject_FormClosed; //Add eventhandler to cleanup after form closes * } * * formProject.Show(this); //Show Form assigning this form as the forms owner * Hide();*/ }