0

I have an MDIParent form with a button in it. I have it so that when i click the button it gets disabled. What i need help on is that, I need to know how to re-enable the button after i exit out of the form that opens when i click the button.

Thanks,
NH1

Edited by NH1: n/a

2
Contributors
6
Replies
12
Views
6 Years
Discussion Span
Last Post by NH1
Featured Replies
  • [CODE] //Global Variables Form frmChild; private void button1_Click(....) { //show child form frmChild=new Form(); frmChild.MDIParent=this; frmChild.Show(); frmChild.FormClosed+=new FormClosedEventHandler(frmChild_FormClosed); //disable your button button1.Enabled = false; } void frmChild_FormClosed(object sender, EventArgs e) { button1.Enabled = true; } [/CODE] Read More

0

So, you have Child Form which opens from the button... you'll implement the event Form Closed of the Child Form to execute this piece of code

yourButton.Enabled = true;
0

So, you have Child Form which opens from the button... you'll implement the event Form Closed of the Child Form to execute this piece of code

yourButton.Enabled = true;

The Problem with that is when i do that there is an error.
"
ToolStripButton3.Enabled = true;
"
The error says this; The name "toolStripButton3" does not exist in the current context;

0

Please clarify, where the button is? Parent Form or the Child one? and tell me the exact scenario.

The Button is in the Parent form. The button opens a child form. When i click the button, opening the the child form, the button gets disabled.
I need to know how to re-enable the button when i exit the child form.

1
//Global Variables
Form frmChild;

private void button1_Click(....)
{
//show child form
frmChild=new Form();
frmChild.MDIParent=this;
frmChild.Show();
frmChild.FormClosed+=new FormClosedEventHandler(frmChild_FormClosed);
//disable your button
button1.Enabled = false;
}

void frmChild_FormClosed(object sender, EventArgs e)
{
button1.Enabled = true;
}
0
//Global Variables
Form frmChild;

private void button1_Click(....)
{
//show child form
frmChild=new Form();
frmChild.MDIParent=this;
frmChild.Show();
frmChild.FormClosed+=new FormClosedEventHandler(frmChild_FormClosed);
//disable your button
button1.Enabled = false;
}

void frmChild_FormClosed(object sender, EventArgs e)
{
button1.Enabled = true;
}

Thanks that worked.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.