how can I stop the beep when I press the return key ?

  • Thread starter Thread starter Guest
  • Start date Start date
It depends on the control.

For a textbox, override OnKeyPress method like the following lines :
protected override void OnKeyPress(KeyPressEventArgs e) {
if ((int)e.KeyChar==13) e.Handled=true;
else base.OnKeyPress (e);
}

For a NumericUpDown control, use these lines :
protected override void OnTextBoxKeyPress(object source, KeyPressEventArgs
e) {
if ((int)e.KeyChar==13) e.Handled=true;
else base.OnKeyPress (e);
}

Hope it helps.

Ludovic SOEUR.
 
Back
Top