Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Carriage Return

Reply
Thread Tools

Carriage Return

 
 
Barnabas (Barney) Yohannes
Guest
Posts: n/a
 
      03-04-2004
Please help me how I can enter text with carriage returns into my database.

I have a Textbox with TextMode="MultiLine"

Now, if inter a text with a carriage return, then, after I enter the text into SQL Server database, when I retrieve the text, I get the text in unwrapped format. Therefore, I have been entering the text with <br> html so that the text will read on the next line.

I was thinking if there is a way to put my text into a loop and search for any carriage return and insert <br> in the place of each carriage return.

Any help is highly appreciated,

Salutations



 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      03-04-2004
Barnabas (Barney) Yohannes wrote:
> Please help me how I can enter text with carriage returns into my database.
>
> I have a Textbox with TextMode="MultiLine"
>
> Now, if inter a text with a carriage return, then, after I enter the text into SQL Server database, when I retrieve the text, I get the text in unwrapped format. Therefore, I have been entering the text with <br> html so that the text will read on the next line.
>
> I was thinking if there is a way to put my text into a loop and search for any carriage return and insert <br> in the place of each carriage return.


You can use the string class's Replace method. Assume str contains the
textbox value:

'VB.NET code follows....
str = str.Replace(vbCrLf, "<br>") ' replaces carraige returns with <br>
' -or-
str = str.Replace("<br>", vbCrLf) ' replaces <br>s with carraige eturns

In C#, you'd use "\r\n" instead of vbCrLf...

Happy Programming!

--

Scott Mitchell
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Carriage Return added during return of large string from class method Xeno Campanoli Ruby 0 02-13-2006 08:39 PM
Help: Delete a single carriage return in a file, but not a double carriage return? Steve Anderson Perl Misc 3 06-21-2004 12:48 AM
Re: Carriage Return/Formatting/ASP/Access Question Jeff Clark ASP .Net 0 10-17-2003 08:43 AM
Re: Carriage Return/Formatting/ASP/Access Question Kevin Spencer ASP .Net 3 10-11-2003 07:19 PM
Postback after carriage return input Ferdi ASP .Net 5 08-24-2003 07:12 AM



Advertisments