I have a program where you type something into a TextBox and press Enter, then it will add the text into a ListBox and erase the TextBox.
It does work!
However, when Enter is pressed, the C:\Windows\Media\Windows Ding.wav
audio plays.
It's honestly just annoying...
Anyone know how to stop that?
Thanks!
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
End If
End Sub
Do you want to disable the beep after Enter pressed? You can try to set property SuppressKeyPress
to True
.
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
e.SuppressKeyPress = True
End If
End Sub