Click here to Skip to main content
15,893,722 members
Articles / Programming Languages / C#

Trying to access form elements from a separate Class - Rephrased Version

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
18 Sep 2012CPOL 2.5K  
I'm trying to access textbox details inside a class that relate to another form. I now have the code working to an extent using {get; set;} but while the method displayDetails works fine from the class Students, if I try making a public method in the Students class to add the details (by passing...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
16 Sep 2012OriginalGriff
The first thing to note is that you really shouldn't be trying at all.If you expose your form controls directly (by making them public) then you lock the design of your form - you can no longer change the way the form works without potentially affecting any other code which may use it. This...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions