Jason Newell said:
Rob,
I have pasted a skeleton class that extends the TextBox class. I use
this class when I need to override some of the default stuff that goes on in
the TextBox control. The main point of interest is the WM_GETDLGCODE that
is sent to the TextBox. You need to detect that message and modify it's
return value as show. This is how you can receive the OnKeyPress() event
for the Enter and Esc key. This will fix the beep for the Enter key, but
not the Esc key. Not sure why. HTH.
That may work, but it's doing it the hard way. ProcessDialogKey lets
you do the same without messing with WndProc, and it will work for Escape
too. In VB, try something like:
Protected Overrides Function ProcessDialogKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.Enter, Keys.Return, Keys.Escape: Return True
Case Else: Return MyBase.ProcessDialogKey(keyData)
End Select
End Function
Jeremy