newlines in textboxes

Discussion in 'ASP .Net' started by headware, Sep 22, 2004.

  1. headware

    headware Guest

    I have some multiline textboxes in a page and I'd like to turn the
    newlines into spaces. I tried using something like this:

    text = text.Replace(Environment.NewLine, " ");

    but it wasn't finding the newlines. I had to do

    text = text.Replace("\n", " ");

    What's going on here?

    Dave
     
    headware, Sep 22, 2004
    #1
    1. Advertising

  2. My guess is Environment.NewLine is actually '\r\n' while the text sent by a
    page is just '\n'..


    --
    Girish Bharadwaj
    http://msmvps.com/gbvb
    "headware" <> wrote in message
    news:...
    > I have some multiline textboxes in a page and I'd like to turn the
    > newlines into spaces. I tried using something like this:
    >
    > text = text.Replace(Environment.NewLine, " ");
    >
    > but it wasn't finding the newlines. I had to do
    >
    > text = text.Replace("\n", " ");
    >
    > What's going on here?
    >
    > Dave
     
    Girish Bharadwaj, Sep 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Newlines in Datagrid

    , Sep 6, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,065
    RenyMatt
    May 4, 2009
  2. Rhino
    Replies:
    2
    Views:
    5,371
    Filip Larsen
    Dec 22, 2003
  3. Porthos
    Replies:
    1
    Views:
    588
    C. M. Sperberg-McQueen
    Jul 27, 2005
  4. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    DB Text with NewLines, etc. for display in a Repeater or DataGrid

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Jun 14, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    473
  5. rihad

    newlines in text files

    rihad, Oct 4, 2003, in forum: C Programming
    Replies:
    7
    Views:
    331
    Micah Cowan
    Oct 6, 2003
Loading...

Share This Page