I have a MDI main form, a menu item that shows a child form (let’s call it frmEmployees), inside this form a Button (btnNew…), how do I open from here a form as Dialog (frmNewEmployee); I mean, frmEmployees can’t be reached until frmNewEmployee has been closed.
// Main_Form_Load
Main_Form.IsMdiContainer = true;
From a menu item in main form, I open frmEmployees
// MenuItem_Click
frmEmployees frmEmp = new frmEmployees();
frmEmp.MdiParent = this;
frmEmp.Show();
from a Button, I open the another form
// newButton_Click
frmNewEmployee frmNE = new frmNewEmployee();
frmNE.MdiParent = this.MdiParent;
//frmNE.Show(); // OK, but allows return to frmEmployees
frmNE.ShowDialog(); // here comes the problem
Is there any method to block frmEmployees while frmNewEmployee is open?
Thanks in advance!
Don’t set frmNE.mdiParent. Let the instance be a child of frmEmployees. To restate, don’t set the mdiParent property and call frmNE.ShowDialog() and the blocked form will be frmEmployee.