Solved

How to reference textbox in Form from another class

Posted on 2011-10-01
2
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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