Link to home
Start Free TrialLog in
Avatar of tomasz_k
tomasz_k

asked on

How to I access my textbox controlls from another class

Hi Experts.

This might be a very simple question, but I need to access my controlls, ie, textbox, checkboxes and such from another class.  The controlls have been created using the Designer in VS, so by default they have Protected on them.  I can't seem to call them from my other classes. Any help?

Thank.
ASKER CERTIFIED SOLUTION
Avatar of tsay
tsay

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tomasz_k
tomasz_k

ASKER

tsay,
This would work, but it just seems like so much overhead.  I'm looking at filling in a form that has about 20 fields, bunch of lists and checkboxes.  I was reading a bit out the Inherits options.  Anyway I could use that to my advantage?

Any OO-programmer here will tell you this is the way to do it. You must not see it as overhead, it's lots of code for you to write but this won't effect your program.

Another option you can do is select the control on your form and change the Identifier property of the control to public but this way you'll have no control at all what is happening with your controls. This is the "quick and dirty" way to achieve what you want.
Thanks for the help, but one more quick question about the Identifier property.  I have went to code behind page and change the property to Public , but once I made some more changes on the form, the property changed back to Protected :( Any ideas how I can make it stay at public?
This is Microsoft telling you to use properties ;p