Hi everyone,
I have a problem regarding enabling the buttons from form2 using form 1 button in csharp...Please help! thanks.
How to enable buttons from form2 controled in form 1
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Jan 30, 2015, 11:02 AM EST
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
}
}
Vithal WadjeRank #19 · 47.2K reputationPosted Jan 29, 2015, 9:06 AM EST
Black Diamond191 reputationPosted Jan 30, 2015, 2:55 AM EST
Black Diamond191 reputationPosted Jan 30, 2015, 2:44 PM EST