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);
}
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.