Shaitan00 Posted August 10, 2008 Posted August 10, 2008 I am trying to find a way to introduce a NEW LINE into a string I am setting for the text of a label, specifically I want the label to span 3 lines... I've tried using "\n" but it doesn't seem to work at all, this is my current code... lblAddress.Text = province.ToString() + " - " + city.ToString() + " - " + address.ToString() + " - " + postal_code.ToString(); [/Code] What I want to do is set the ADDRESS on another line and the POSTAL_CODE on another line so that the text of the label spans 3 lines, something like the following: Ontario Toronto 123 Mission Street D4C 4D4 [Code] lblAddress.Text = province.ToString() + " - " + city.ToString() + "\n" + address.ToString() + "\n" + postal_code.ToString(); [/Code] But this doesn't work ... any clue why? This is to be used with an ASP:LABEL in ASP.NET 2.0 (not a form label) - incase this makes any difference... Any help would be greatly appreciated... Thanks, Quote
Administrators PlausiblyDamp Posted August 10, 2008 Administrators Posted August 10, 2008 If you are doing this in html then you will need to use a tag for a new line. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mandelbrot Posted August 11, 2008 Posted August 11, 2008 For Windows you can use System.Environment.NewLine. Also for labels you'll need to make sure the AutoSize and AutoEllipsis properties aren't set. Paul. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.