473,382 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

updating a textbox on a form from another class

Hello

i have a textbox on a form1.

I want to pass the name of that textbox as a paramter to another class
(not a form class) and once gotten this paramter i want to update the
textbox on form1 and display text data as data is retrieved via this
other class.

can anyone point or provide some sample code of how this would be done
please
thanks
Jan 12 '07 #1
4 3194
Hi,
Dont pass the name of the textbox, pass the
System.Windows.Forms.TextBox itself to your other class, then you can
update its .Text property (or any of the other public properties).

HTH,
James Randle.

Peted wrote:
Hello

i have a textbox on a form1.

I want to pass the name of that textbox as a paramter to another class
(not a form class) and once gotten this paramter i want to update the
textbox on form1 and display text data as data is retrieved via this
other class.

can anyone point or provide some sample code of how this would be done
please
thanks
Jan 12 '07 #2
Hi,
Dont pass the name of the textbox, pass the
System.Windows.Forms.TextBox itself to your other class, then you can
update its .Text property (or any of the other public properties).

HTH,
James Randle.

Peted wrote:
Hello

i have a textbox on a form1.

I want to pass the name of that textbox as a paramter to another class
(not a form class) and once gotten this paramter i want to update the
textbox on form1 and display text data as data is retrieved via this
other class.

can anyone point or provide some sample code of how this would be done
please
thanks
Jan 12 '07 #3
A more re-usable approach is to expose events and properties on the
class, and have the form respond to those events by updating the
textbox itself. This allows the UI to be re-written (perhaps just
tweaking to a SuperSpiffyTextBox[tm], but perhaps in a radical way -
webforms, wpf, etc) while leaving the non-UI class alone.

Encapsulation, etc...

Marc
Jan 12 '07 #4

thanks for the info,

im sorry i dont understand what is meant by the textbox itself, do you
mean a pointer to the control ?

a sample would be appreciated

thanks

On 12 Jan 2007 03:33:24 -0800, "pigeonrandle"
<pi**********@hotmail.comwrote:
>Hi,
Dont pass the name of the textbox, pass the
System.Windows.Forms.TextBox itself to your other class, then you can
update its .Text property (or any of the other public properties).

HTH,
James Randle.

Peted wrote:
>Hello

i have a textbox on a form1.

I want to pass the name of that textbox as a paramter to another class
(not a form class) and once gotten this paramter i want to update the
textbox on form1 and display text data as data is retrieved via this
other class.

can anyone point or provide some sample code of how this would be done
please
thanks
Jan 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: trint | last post by:
I have a textbox (textBox7) that isn't updating.. Is there a way, after I type new text in it, to have it update? It seems to be fairly normal: public class Form1 : System.Windows.Forms.Form {...
28
by: kfrost | last post by:
I know this is probably simple but I have a C# form and the class for the form is called sbaSynch. I have a textbox name txtServerName. I'm creating a class to manipulate XML functions so I...
3
by: Colin Young | last post by:
I'm having a bit of a problem with my DataList when I try to update from the user's input. I've included relevant excerpts at the end of this message. In the UpdateCommand code, the...
10
by: sqlboy2000 | last post by:
Hello all, I have something very simple going on here and I'm scratching my head as to what the problem is. There are 4 items in my project, 2 webforms, a user control, and a module: ...
4
by: Art | last post by:
Hi, I have a main form for my project. It uses a routine in another class to do work on a file -- line by line. I'd like to have a text box on my form display the lines, say every 5,000 -- so...
22
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same...
5
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
0
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.