Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42441

Either suppress sound or suppress the enter key press?

$
0
0
I'm still relatively new to programming so bear with me. I'm writing a logic/probability game solver application and I'm nearly done; I'm just working on the ease of use, the interface, etc...

On the game board, I have various NumericUpDown controls that hold values for different cards. When the user enters a value for a previously unknown card, I want them to be able to press enter (while the focus is on the NumericUpDown) and then have the program run the logical/probability tests. I want the user to be able to press enter here and have the same effect as if they had pressed the 'Calculate' button. I have that working, but, when enter is pressed, there is a beep system sound from the NumericUpDown and I don't want the beep sound going off every time the user presses enter.

Here is the code as I had it before looking online:
Code:

Private Sub NumericUpDown1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
        Handles NumericUpDown1.KeyPress
        If e.KeyChar = Chr(13) Then 'Chr(13) = enter key
            CalculateButton_Click(Me, EventArgs.Empty) 'Run calculations
        End If
End Sub

I've looked into a number of methods online but I can't seem to suppress the key press or only mute the sounds from my application (I could mute ALL sounds... but that's no good).

Thanks for any help!

Viewing all articles
Browse latest Browse all 42441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>