Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get carriage return to display

Status
Not open for further replies.

M8KWR1

IS-IT--Management
Dec 8, 2008
20
0
0
GB
I am accessing an sql table with a text field.

I am adding a label control at runtime, with the data from the above field.

When i am creating the data it contains carriage returns, but when it is displayed on the webpage, it is just one line of text.

What are my options to get this work. I know i could have many labels with all different aspects of the text i am trying to display, but this would also create additional columns in the sql table.

Many thanks
 
Try something like
Code:
MyLabel.Text = MyLabel.Text.Replace(ControlChars.CrLf, "<br>")

 
brilliant, that works.

is there another way so a user would not have to put the <br> into the text??


 
You've lost me, where in RiverGuy's answer does the user have to input the <br>?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
The user enters the CrLf, but when you display the string in the text box, you use the Replace function for the display.
 
sorry, my fault i was reading it up-side down and back-to-front...

Many thanks again, perfect... i should of tested it before i commented....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top