943,824 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 2300
  • C# RSS
Apr 18th, 2009
0

label that display all textbox input in prose form

Expand Post »
how do i go about doing this in visual studio 2005. I am able to display in the label with only one text box information, but i want the label to display multiple text box information in same label

This is what i use to display one textbox information in a label
lblResult.Text = Convert.ToString(txtName.Text);
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lyvenice is offline Offline
5 posts
since Apr 2009
Apr 18th, 2009
0

Re: label that display all textbox input in prose form

Not exactly sure what you are asking for, but it is just a string, so you can concat the other textbox values into a single label using the (+) operator.
C# Syntax (Toggle Plain Text)
  1. lblResult.Text = txtName.Text + " " + nextTxtName.Text + " "; // and so on...

If this is NOT what you are trying to do then provide a sample of what you want it to look like.


// Jerry
Reputation Points: 69
Solved Threads: 75
Posting Pro in Training
JerryShaw is offline Offline
465 posts
since Nov 2006
Apr 18th, 2009
0

Re: label that display all textbox input in prose form

yeah this is what i am trying to do, but do u know what i can add to it so txtName.Text is on one line, and nextTxtName.Text is on the second line?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lyvenice is offline Offline
5 posts
since Apr 2009
Apr 18th, 2009
0

Re: label that display all textbox input in prose form

Use the newline character \n for that.
Like in :
this.label1.Text = "azerty" + "\n" + "querty";
Will put
azerty
querty

in your label.
Reputation Points: 2035
Solved Threads: 644
Senior Poster
ddanbe is offline Offline
3,738 posts
since Oct 2008
Apr 18th, 2009
0

Re: label that display all textbox input in prose form

Click to Expand / Collapse  Quote originally posted by lyvenice ...
how do i go about doing this in visual studio 2005. I am able to display in the label with only one text box information, but i want the label to display multiple text box information in same label

This is what i use to display one textbox information in a label
lblResult.Text = Convert.ToString(txtName.Text);
Hi

You have to use concatenation and in C# this is done be '+' plus sign. by using this you can concatenate as many strings, integers or data as you want. for example, if you have two textboxes , text box1 and textbox2 and want to display their text in label then you would do somehting like this;

lblResult.Text = this.textbox1 + this.textbox2;
//above will not have space between two texts, however, if you want space in between text of both text boxes you can do this as follows;

lblResult.Text = this.textbox1 + " " + this.textbox2;

Similarly you can add as many fileds as you want.

HTH

Sarah
Reputation Points: 10
Solved Threads: 1
Light Poster
brainbox is offline Offline
29 posts
since May 2006
Apr 18th, 2009
0

Re: label that display all textbox input in prose form

thank you'll very much ,I have one last question, is it possible to display text in the label with the text box info.
For example: lblResult.Text = this.textbox1 + " " + this.textbox2;
i want the label to display something like "Name: this.textbox1"
like if i type in my name is this.textbox1 can I get the label to return Name: "My name", So if i type in jason in textbox 1, it is possible to return Name: jason instead of just jason in the label
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lyvenice is offline Offline
5 posts
since Apr 2009
Apr 18th, 2009
0

Re: label that display all textbox input in prose form

Click to Expand / Collapse  Quote originally posted by lyvenice ...
thank you'll very much ,I have one last question, is it possible to display text in the label with the text box info.
For example: lblResult.Text = this.textbox1 + " " + this.textbox2;
i want the label to display something like "Name: this.textbox1"
like if i type in my name is this.textbox1 can I get the label to return Name: "My name", So if i type in jason in textbox 1, it is possible to return Name: jason instead of just jason in the label

YES you can ... you would have the actual text gardcoded i.e. which wont change unlike text boxes and then u can concatenate it with text boxes so you would have it like below (for name and for age for example)

lblName.Text = "Name:" + this.textbox1.Text;
lblAge.Text = " Age" + this.txtAge.Text;

HTH

Regards
Sarah
Reputation Points: 10
Solved Threads: 1
Light Poster
brainbox is offline Offline
29 posts
since May 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Multiple field combo box
Next Thread in C# Forum Timeline: Printing without a print dialog?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC