Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Prevent Beep on Enter (Again)

155 views
Skip to first unread message

Jay Banks

unread,
May 5, 2004, 3:54:16 PM5/5/04
to
I know this was recently posted in reference to a textbox, but I'm
having a similar problem, and can't keep it from beeping. I'm using a
NumericUpDown control instead of a textbox. I've tried this code in the
KeyPress and the KeyDown events. None of the below code prevents the beep.

If e.KeyCode = Keys.Enter Then
e.Handled = True
...
End If

If e.KeyChar = vbCr Then
e.Handled = True
...
End If

If e.KeyChar = Chr(13) Then ' Same as above
e.Handled = True
...
End If

J.
--
The email address listed is not my real address. Please do not send
valid email to that address.

Armin Zingler

unread,
May 5, 2004, 4:23:49 PM5/5/04
to
"Jay Banks" <spamr...@chooseyourmail.com> schrieb

> I know this was recently posted in reference to a textbox, but I'm
> having a similar problem, and can't keep it from beeping. I'm using
> a
> NumericUpDown control instead of a textbox. I've tried this code in
> the KeyPress and the KeyDown events. None of the below code
> prevents the beep.

Derive your own Control from NumericUpdown and add this code:

Protected Overrides Sub OnTextBoxKeyPress( _
ByVal source As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs)

If e.KeyChar = Chr(13) Then

e.Handled = True
Else
MyBase.OnKeyPress(e)
End If
End Sub

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

0 new messages