Textbox beep

I'm using a textbox. Multiline and AcceptReturn are set to True

I want to detect a carriage return and I have the following code:

Private Sub tb1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tb1.KeyPress

If e.KeyChar = Chr(Keys.Enter) Then Parse()

End Sub

It works as desired BUT I receive a beep when the parse code completes. I also receive a beep if nothing is called in the kepress routine.

What is the significance of this beep and how do I turn it off




Answer this question

Textbox beep

  • Trent Ballew

    Gracias to both of you. :)

  • LTD

    Hi,

    What Cathal Connoly meant wa to do this:

    Private Sub tb1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tb1.KeyPress

    If e.KeyChar = Chr(Keys.Enter) Then
    Parse()
    e.Handled = true
    End If

    End Sub

    cheers,

    Paul June A. Domag



  • Lorenzom_MSFT

    add e.Handled=true after the If e.Keychar... line, it will signal that the keypress has been handled and supress the beep.

    Cathal

  • Iza

    Cathal,

    When I did that, I don't see any characters in the textbox at all. That's a surprise.



  • Textbox beep