eneble/disable button via class
In the main form, the button is disable that, after fulfilling the conditions in the external class must activate the button. can you help me? Thanks so much for all the advice. Mark
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 Aug 6, 2011, 11:04 AM
Your first line would create a new instance of Form1 rather than accessing the existing instance.
Vilas GitePosted Aug 6, 2011, 9:42 AM
Form1 f1 = new Form1();
button1.Enabled = false;
For more details about Windows Controls in C#:
http://www.c-sharpcorner.com/1/77/
---------------------------------------------------mark AdamekPosted Aug 6, 2011, 8:45 AM
main_form f1 = (main_form) Application.OpenForms ["main_form"];
f1.button.Enabled = false;
VulpesPosted Aug 6, 2011, 8:13 AM
Form1 f1 = (Form1)Application.OpenForms["Form1"];
Button b1 = (Button)f1.Controls["button1"];
b1.Enabled = true;