protected override void OnKeyDown(KeyEventArgs e)
if (e.KeyCode == Keys.Enter)
e.SuppressKeyPress = true; // stop the bell!!!
Sunday, 6 June 2010
If you're a fan of your keyboard shortcuts, you might notice that windows sometimes emits a beep (or bell) after pressing enter to select something. Prevent the bell by setting the KeyDown eventargs SuppressKeyPress member to 'true' if the enter key was pressed.