control in another form
-
how can i access control (like button) in one form(form 1) from another from(form 2).. i want to set the enabled property of this control rom form 2
-
Set the "Modifiers" property of this control to public (or set the button access level to public by your self). After that you will be able to see that control in the intelisense from another form. Enjoy
-
Errm do: public static System.Windows.Forms.Button YourButton; then change all 'this.YourButton' to just 'YourButton' (without the 'this.') Then you can just access the button from anywhere, works for me, well i've never done it for a button but, im sure it'll be fine.
-
how can i access control (like button) in one form(form 1) from another from(form 2).. i want to set the enabled property of this control rom form 2
m.m._2007 wrote:
how can i access control (like button) in one form(form 1) from another from(form 2).. i want to set the enabled property of this control rom form 2
If you have a webForm1 page with one button on it you could do this webForm1 sf = new webForm1(); sf.Controls["button"].enabled=false; sf.Show(); When the form opens the button would be disabled. Of course you need to know the controls name, or index. I hope this was usefull:)
-
how can i access control (like button) in one form(form 1) from another from(form 2).. i want to set the enabled property of this control rom form 2
HI, You can just create a function in the first form and declare it as public. In the body of this function you can right the property changes of the button that u wish. And just call this function from the second form. This will do i think, Jamil Abou Khalil