Answered Prevent Beep when pressing enter

jcardana

Old to VB6, New to VB.NET
Joined
Oct 26, 2015
Messages
72
Location
Rio Rancho, NM
Programming Experience
Beginner
When I press enter to move to the next textbox, it "beeps".
Because we don't have Control arrays, I'm changing the "Enter" code input to the "Tab" so it will "Tab" to the next box.
How do I stop the beeping. In VB6 I just made the code keycode =0

Thank you for your time and effort,
Joe

KeyDown Event:
    Sub txtPresets_keydown(sender As Object, e As KeyEventArgs) Handles txtFilePresetName.KeyDown, txtPresetA0.KeyDown, txtPresetA1.KeyDown, txtPresetA2.KeyDown, txtPresetA3.KeyDown, txtPresetA4.KeyDown, txtPresetA5.KeyDown, txtPresetA6.KeyDown, txtPresetA7.KeyDown, txtPresetA8.KeyDown, txtPresetA9.KeyDown, txtPresetA10.KeyDown,
            txtPresetB0.KeyDown, txtPresetB1.KeyDown, txtPresetB2.KeyDown, txtPresetB3.KeyDown, txtPresetB4.KeyDown, txtPresetB5.KeyDown, txtPresetB6.KeyDown, txtPresetB7.KeyDown, txtPresetB8.KeyDown, txtPresetB9.KeyDown, txtPresetB10.KeyDown,
            txtPresetC0.KeyDown, txtPresetC1.KeyDown, txtPresetC2.KeyDown, txtPresetC3.KeyDown, txtPresetC4.KeyDown, txtPresetC5.KeyDown, txtPresetC6.KeyDown, txtPresetC7.KeyDown, txtPresetC8.KeyDown, txtPresetC9.KeyDown, txtPresetC10.KeyDown,
            txtPresetD0.KeyDown, txtPresetD1.KeyDown, txtPresetD2.KeyDown, txtPresetD3.KeyDown, txtPresetD4.KeyDown, txtPresetD5.KeyDown, txtPresetD6.KeyDown, txtPresetD7.KeyDown, txtPresetD8.KeyDown, txtPresetD9.KeyDown, txtPresetD10.KeyDown,
            txtPresetE0.KeyDown, txtPresetE1.KeyDown, txtPresetE2.KeyDown, txtPresetE3.KeyDown, txtPresetE4.KeyDown, txtPresetE5.KeyDown, txtPresetE6.KeyDown, txtPresetE7.KeyDown, txtPresetE8.KeyDown, txtPresetE9.KeyDown, txtPresetE10.KeyDown

        If e.KeyCode = Keys.Enter Then
            e.Handled = True
            SendKeys.Send(Chr(9))
        Else
            MyBase.OnKeyDown(e)
        End If

    End Sub
 
Last edited:
VB.NET:
e.SuppressKeyPress = True

You should remove MyBase.OnKeyDown(e) - OnKeyDown is what raises the KeyDown event, and MyBase in this context is the form class.
 
Again... Thank you and Bless your heart! This was my last issue.
 
Back
Top