TAB key and Keypress

  • Thread starter spongebob-straight pants
  • Start date
S

spongebob-straight pants

Hi all,
When I press the tab key, I cannot fire the keyup and the keydown or any
keypress events
How then would I capture those events?

Thanks
 
H

Herfried K. Wagner [MVP]

spongebob-straight pants said:
When I press the tab key, I cannot fire the keyup and the keydown or any
keypress events

Add this to your form's code:

\\\
Protected Overrides Function ProcessTabKey(ByVal forward As Boolean) As
Boolean
MyBase.ProcessTabKey(forward)
MsgBox("Tab key was pressed!")
End Function
///
 
J

Jay B. Harlow [MVP - Outlook]

Sponge Bob,
In addition to the other comments.

There are a number of advanced keyboard overrides, unfortunately I don't
have any real good examples of using these, other then they allow you to
intercept the key significantly earlier
then the OnKey* methods, including the Tab key.

I want to say you want to use IsInputChar or IsInputKey to check for a Tab,
if its a Tab returning false will allow the Tab to be handled by your
control. I normally override all the advanced keyboard overrides, watch
(w/Debug.WriteLine) the values coming out to determine which one to actually
use...

*advanced keyboard overrides include: IsInputChar, IsInputKey,
PreProcessMessage, ProcessCmdKey, ProcessDialogChar, ProcessDialogKey,
ProcesKeyEventArgs, ProcessKeyMessage, ProcessKeyPreview, and
ProcessMnemonic.

If I find an example I will post one later...

Hope this helps
Jay
 

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

Top