Solved

How to reference textbox in Form from another class

Posted on 2011-10-01
2
240 Views
Last Modified: 2013-12-16
I have a form with textboxes in it.  I have a separate class where I need to reference those textboxes.  I have tried everything I can think of and nothing seems to work.

What's the correct way to do this?
0
Comment
Question by:rmmarsh
2 Comments
 
LVL 4

Accepted Solution

by:
jacekmalinowski earned 500 total points
ID: 36897147
Hi,

You shouldn't mix up logic in class with GUI elements.

The best way is to make 2 methods in code behind in the from:

void BindTextboxesData()
{
// set here textboxes values from your class data.
}

void GetTexboxesData()
{
// get textboxes values and set to your class properties
}
0
 

Author Closing Comment

by:rmmarsh
ID: 36897209
Thank you...
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question