Results 1 to 5 of 5

Thread: How to display new line?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Posts
    166

    Exclamation How to display new line?

    Hello guys! I am new in ASP.NET and Oracle database.. I just wonder on how to display new line from browser? I use multi-line textbox control to place all comments of the user. The user wants to see all new lines from the browser after clicking the print button. By the way, i user literal control to display the records accordingly. I tried creating a function that replaces all "\n" to "<br>"

    Here's my code :

    Code:
    public function RecognizeNewLines(byVal myString as String) as String
    Dim newString as String = String.Empty
    newString = myString.Replace("\n", "<br>")
    return newString
    Am I missing something ? I dont know how to capture new lines in oracle . Is this the proper way to solve this issue?

    Thanks guys

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to display new line?

    It won't necessarily be \n. It may be \r\n as I've seen quite commonly in a few DBMSs. You could also try looking for System.Environment.Newline in myString and replacing with <br />.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Posts
    166

    Re: How to display new line?

    Thanks for the reply. I tried looking on how oracle represents new line in database but unfortunately I didn't see any "\n" or "\r" in the database.. Does oracle have different representation for new line ? If so, what is it? Thanks guys!

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to display new line?

    OK, what do you get in the debugger visualizers (tooltips) when you retrieve the data from Oracle?

    So what I'm asking you to try is to retrieve some data from your Oracle table that you know contains a line break, then set a breakpoint on that line. When it's hit, mouseover or quickwatch the (for example) datarow and look at how the newline is represented.

  5. #5
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: How to display new line?

    I think string.replace("\n" .... will actually look for the characters "\n" not a line feed.

    if you try regex \n & \r should work like regex.replace(myString, "\n", "<br>")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width