Results 1 to 4 of 4

Thread: Replace enter with space [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Replace enter with space [RESOLVED]

    Hi all,

    I have a multiline textbox in which user enters some text and then I add those values in a combobox. Before adding to combo, I need to convert "Enter" key press with a single space. How can I convert "Enter" with a single space.

    Thanks.
    Last edited by usamaalam; Dec 6th, 2004 at 11:51 PM.

  2. #2
    Junior Member
    Join Date
    Jul 2004
    Posts
    20

    Re: Replace enter with space

    Search for \r\n (<enter> - new line) and replace that with a space.

  3. #3
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476

    Re: Replace enter with space

    Have a look at my answer in this post!

    http://www.vbforums.com/showthread.p...21#post1855721
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Re: Replace enter with space

    That code works, but this might be better for future proofing:

    Code:
    string text = textBox5.Text;
    text = text.Replace(System.Environment.NewLine," ");
    textBox5.Text = text;

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