joypad and textbox caret with keydown event

  • Thread starter Thread starter Coder
  • Start date Start date
C

Coder

Hi,



Is there a way to cancel a keydown even from within the keydown event? In
eVB i can cancel the event or change the keycode in the event to 0 but in VB
..NET the keycode and keyvalue are read only. I use the textbox and form
keydown event to trap keys for the mouse pad (joypad). However, I DON'T want
the caret in the textbox to move up, down, left or right. I want to use the
mouse pad keys for other things. I also must keep focus on the textbox so
that selected text doesn't disappear as it does when the textbox loses
focus.



Any ideas?
 
You can try to set the Handled property of the
System.Windows.Forms.KeyEventArgs parameter in the event to False:

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

e.Handled = True

End Sub
 

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