Hi everyone,
I have a problem regarding enabling the buttons from form2 using form 1 button in csharp...Please help! thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jan 30, 2015, 4:02 PM
First change the Modifiers property of the button (or buttons) in Form2 you want to enable from private to internal. This can be done from the Properties Box.
The code to enable it from a button on Form1 wll be then be along the following lines:
private button1_Click (object sender, EventArgs e)
{
Form2 f2 = Application.OpenForms["Form2"] as Form2;
if (f2 != null)
{
f2.button1.Enabled = true;
// and so on for any other buttons
}
}
Black DiamondPosted Jan 30, 2015, 7:44 PM
Black DiamondPosted Jan 30, 2015, 7:55 AM
Vithal WadjePosted Jan 29, 2015, 2:06 PM