problem with textbox in a user control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,
This is my problem:
I developed a user control which contains a textbox. When the user control
is a part of the main form, it should capture the enter button(i.e., respond
to enter button). I tried using control_keyup event, but it doesnt fire., any
ideas or suggestions. thanks in advance


~Ken
 
Check out ProcessCmdKey:

Inherits System.Windows.Forms.ComboBox
Const WM_KEYDOWN As Integer = &H100

Protected Overrides Function ProcessCmdKey _
(ByRef msg As System.Windows.Forms.Message, _
ByVal keyData As System.Windows.Forms.Keys) As Boolean

If msg.Msg = WM_KEYDOWN Then
Return Not ((keyData >= Keys.D0 And keyData <= Keys.D9) _
Or keyData = Keys.Back Or keyData = Keys.Left _
Or keyData = Keys.Right Or keyData = Keys.Up _
Or keyData = Keys.Down Or keyData = Keys.Delete)
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
 

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

Back
Top