Remove Enter key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DragonLord
    New Member
    • Mar 2007
    • 122

    Remove Enter key

    Here is the issue, I am passing the information from a text box to do a comparison.

    what is happening is the first one comes out as just text.. i.e. "123"
    and the second
    comes out as "\r\n123"

    If i use the .Replace("\r"," ") function it also removes r from the typed text...

    Please help! I need to make sure that the enter key is not there so that is comparing "123" to "123"
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    If you do not want \r and \n when you will compare the text from Textbox,
    you can get text "123" using Substring function.
    e.g.

    Code:
     
           Dim strText as String =""
           ''Get original string
           strText = TextBox1.text
    
           ''Extract the string required for comparision from original string
           strText = strText.subString(index)

    Originally posted by DragonLord
    Here is the issue, I am passing the information from a text box to do a comparison.

    what is happening is the first one comes out as just text.. i.e. "123"
    and the second
    comes out as "\r\n123"

    If i use the .Replace("\r"," ") function it also removes r from the typed text...

    Please help! I need to make sure that the enter key is not there so that is comparing "123" to "123"

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Try using Replace('\r',"" ) instead, which should NOT remove regular "r"s. (Although ("\r","") shouldn't have either.
      If it only occurs at the end/begining of your string, you could try using Trim("\r\n") or whatever

      Comment

      Working...