I have two forms. I have a button in mainForm. When i clicked button1 the main form will show and the button1 will be Enabled false. Now i want to Enable it to True when my ChildForm gets Close. PLease help me . My code For Enable= False is
CstmersFrm cstFm = new CstmersFrm();
cstFm.MdiParent = this;
cstFm.Show();
cstFm.BringToFront();
btnCstmr.Enabled = false;
Iam trying to Enable= True is In cstmersFrm _Closed Event
mFrm = (mainForm)this.MdiParent;
mFrm.btnCstmr.Enabled = true;
You need to register to the child form Closed event on the main form:
Form child = new Form();
child.MdiParent=this;
child.Show();
child.FormClosed+=child_FormClosed;
and then set the button to Enabled:
void child_FormClosed(object sender, FormClosedEventArgs e)
{
btnCstmr.Enabled = true;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.