How do I get rid of the carriage control in text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LegalIT
    New Member
    • Feb 2008
    • 15

    How do I get rid of the carriage control in text box

    Hello,

    I have a text box that I would like the user to be able to type in the beginning of the entry, press <enter> and go to the correct record. I have it working correctly for a one line text box. When I increase the text box to multi-line I get an unwanted result. When the user enters text and presses enter I go to the correct record as I want. The problem is that the carraige control stays in the text box. So my record shows up on the second line of the textbox instead of the first line. I set the textbox.text to "" before I assign the correct value but the carriage control remains.

    If e.KeyValue = 13 Then
    GoToUser()
    End If

    Is there a way to clear out the carriage control so my text starts on the first line of the text box?

    Thanks!
    LegalIT
  • TTCEric
    New Member
    • Jul 2008
    • 26

    #2
    You can use Replace function:

    Textbox1.Text = Replace(textbox 1.Text, vbCRLF, "")

    Comment

    Working...