1

Trying to disable the 'ding' sound when hitting enter from a textbox.

My code:

Private Sub StoreNumberBox_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles StoreNumberBox.KeyUp

        If BackgroundWorker1.IsBusy Then
            Exit Sub
        Else
            If e.KeyCode = Keys.Enter Then
                ClearTextBox(Me)
                PullIPs()
            End If
        End If
    End Sub

Now, before I get a bunch of nasty grams. I googled the hell out of this issue, and all results came back to adding the following code:

Private Sub StoreNumberBox_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles StoreNumberBox.KeyUp

    If BackgroundWorker1.IsBusy Then
        Exit Sub
    Else
        If e.KeyCode = Keys.Enter Then
            e.SuppressKeyPress = True 'add me
            ClearTextBox(Me)
            PullIPs()
        End If
    End If
End Sub

The above code makes no difference for me. Am I doing something wrong, or is there another option?

dwb
  • 475
  • 6
  • 31
  • 1
    The ding happens in KeyDown - see the answer at http://stackoverflow.com/questions/6290967/stop-the-ding-when-pressing-enter/16350929#16350929 – shf301 Aug 29 '15 at 04:17
  • Thanks guys, Fixed with Me.AcceptButton = PullIPButton – dwb Aug 29 '15 at 04:27

0 Answers0