Hi there
Am a new student in C# and am using Microsoft Visual C# 2013.
My aim is to
i. open a child form inside its MDIparent form
ii. disable the MDIparent form when the child form is active/opened
it was easier in VB.net with
frmStuDetails.ShowDialog()
I have tried
1.
MyChildForm childForm = new MyChildForm();
childForm.ShowDialog(this);
Result....but the problem is that the child form doesn't open within the MDIparent form/container
2.
under MDIparent call button
frmViewStuList childForm = new frmViewStuList(this);
childForm.Owner = this;
childForm.Show();
under child from Activated
if (this.Owner != null)
{
this.Owner.Enabled = false;
}
under child form Deactivate
if (this.Owner != null)
{
this.Owner.Enabled = true;
}
Result.....it makes the child form active but freezes the MDIparent when the child form closes
3.
ChildForm child = new ChildForm();
child.Owner = this;
child.Show();
// In ChildForm_Load:
private void ChildForm_Load(object sender, EventArgs e)
{
this.Owner.Enabled = false;
}
private void ChildForm_Closed(object sender, EventArgs e)
{
this.Owner.Enabled = true;
}
Result ....It seems to be the best option but the child form doesn't open within the MDIparent
Please help if you have any other idea
Thanks
Loading
Abdu RafeeqPosted Feb 2, 2016, 11:21 PM