Solved

How to reference textbox in Form from another class

Posted on 2011-10-01
2
243 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

Stack Overflow Podcast - Frustrating Miracles

In this podcast, Stack Overflow interviewed Linux Academy CEO/Founder, Anthony James, and got his developer story!

"Follow your passion, be prepared to work hard and sacrifice, and, above all, don't let anyone limit your dreams."  - Donovan Bailey

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 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