Reputation: 31
so the title say it all kinda. I have an MDI parent that opens up a child that lets me view a data grid but this child lets me select a row and open up a different child from of the parent that lets me edit the data row. how do i disable the previous child till the current one is closed. kinda like ShowDialog() but for child forms ?
any help would be great :)
Upvotes: 0
Views: 762
Reputation: 1873
Disable the form when you open the new one and re-enable on the form closed event of the child form
Wherever you are opening the child form:...
{
ChildForm f = new ChildForm();
f.FormClosed += F_FormClosed;
f.Show();
this.Enabled = false;
}
and
private void F_FormClosed(object sender, FormClosedEventArgs e)
{
this.Enabled = true;
}
Upvotes: 2
Reputation: 2111
How about this?
this.MdiParent.MdiChildren[0].Enabled = false;
Upvotes: 0