Preventing "ding!" on Esc or Enter in a textbox

N

Nic L

Anybody know how to prevent the ding sound from happening when the escape or
enter key is entered into a textbox? I need to catch the enter and escape
keys for processing.

I've the following event handler for on the Keydown event of the text box,
but I'm still getting the ding sound.

private void EditBoxKeyDown(object sender, System.Windows.Forms.KeyEventArgs
e)
{
if ( e.KeyCode == Keys.Enter )
{
/* do some processing */
e.Handled = true;
}
if ( e.KeyCode == Keys.Escape )
{
/* do some processing */
e.Handled = true;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top