Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

How to trap TAB keystroke

How do I trap the TAb keystroke?  The KeyDown event doesn't recognize vbKeyTab and KeyPress doesn't recognize KeyAscii = 9.
0
craigdawson
Asked:
craigdawson
  • 2
1 Solution
 
vikiingCommented:
You have to use KeyPress() event, not KeyDown.

0
 
craigdawsonAuthor Commented:
I tried that without success.  Do you have a snippet of working code?
0
 
vikiingCommented:
This silly code will put at screen ASCII codes of the keys you type. And you can see the 9 for the TAB key:

Private Sub Form_KeyPress(K%)
Form1.Visible = True
Form1.AutoRedraw = True
?K%;
End Sub

0
 
ratsifaCommented:
You may should set the KEYPREVIEW = True for the Form load event.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now