label that display all textbox input in prose form

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2009
Posts: 5
Reputation: lyvenice is an unknown quantity at this point 
Solved Threads: 0
lyvenice lyvenice is offline Offline
Newbie Poster

label that display all textbox input in prose form

 
0
  #1
Apr 18th, 2009
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);
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 436
Reputation: JerryShaw is on a distinguished road 
Solved Threads: 72
JerryShaw JerryShaw is offline Offline
Posting Pro in Training

Re: label that display all textbox input in prose form

 
0
  #2
Apr 18th, 2009
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.
  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
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 5
Reputation: lyvenice is an unknown quantity at this point 
Solved Threads: 0
lyvenice lyvenice is offline Offline
Newbie Poster

Re: label that display all textbox input in prose form

 
0
  #3
Apr 18th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,955
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 282
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: label that display all textbox input in prose form

 
0
  #4
Apr 18th, 2009
Use the newline character \n for that.
Like in :
this.label1.Text = "azerty" + "\n" + "querty";
Will put
azerty
querty

in your label.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 29
Reputation: brainbox is an unknown quantity at this point 
Solved Threads: 1
brainbox's Avatar
brainbox brainbox is offline Offline
Light Poster

Re: label that display all textbox input in prose form

 
0
  #5
Apr 18th, 2009
Originally Posted by lyvenice View 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);
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 5
Reputation: lyvenice is an unknown quantity at this point 
Solved Threads: 0
lyvenice lyvenice is offline Offline
Newbie Poster

Re: label that display all textbox input in prose form

 
0
  #6
Apr 18th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 29
Reputation: brainbox is an unknown quantity at this point 
Solved Threads: 1
brainbox's Avatar
brainbox brainbox is offline Offline
Light Poster

Re: label that display all textbox input in prose form

 
0
  #7
Apr 18th, 2009
Originally Posted by lyvenice View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC