How to Stop Window Error Sound When Typing ‘Enter’ or ‘Esc’

In the KeyDown event, set e.Handled = true and e.SuppressKeyPress = true

OR

protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == Keys.Escape || keyData == Keys.Enter) {
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}

Leave a Reply