Link to home
Start Free TrialLog in
Avatar of khacharn
khacharn

asked on

Newline character in multiline textbox in asp.net

Hi All,

Want help for solving query reg how to insert newline in multiline textbox in asp.net with
codebehind as vb.net.
for eg i want to display "Hello How r u" in different line like :
"Hello"
"How "
"r"
"u"
txtlinkDetails.Text="hello" & "<br />".

Waiting for response.

Thnks & Rgds.
Avatar of thetool
thetool

Try using a \r\n they are the carriage return and new line escape characters.  So txtlinkDetails.Text="hello\r\n";
vbCRLF doesn't work ? it's the constanst for \r\n
\r\n are for c#

txtlinkDetails.Text="hello" & vbCRLF & "How" & vbCRLF &"r" & vbCRLF & "u"
Can you use the System.Enviroment.Newline property so it would be something like:


txtlinkDetails.Text="hello" & System.Enviroment.Newline & "How" & System.Enviroment.Newline &"r" & System.Enviroment.Newline  & "u"

Bryan
Text = Text.Replace(" ", vbCrLf)

If what you're writing is HTML maybe you should replace vbCrLf with "<BR>" as in

Text = Text.Replace(" ", "<BR>")
ASKER CERTIFIED SOLUTION
Avatar of angelfeijoo
angelfeijoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So was the problem that you didn't have TextMode and runat set correctly?  If not why didn't you accepts sweetsgreen answer who was the first one to tell you to use vbCrLf?