Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you watch for a user pressing a cursor key?

Status
Not open for further replies.

elziko

Programmer
Nov 7, 2000
486
GB
Key_Press, Key_Down dont work for the cursor keys. Anyone help me on this one?

Thanks

elziko
 
check for the KeyCode (as in the code below) on the relevant control. The cursor keys will give keycodes of 37,38,39 and 40. The shift value is 0, 1 if [tt]shift[/tt] is pressed and 2 if [tt]ctrl[/tt] is pressed


[tt]Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer)
MsgBox KeyCode & " --- " & Shift
End Sub[/tt]

my application is an MDI environment and i recall having to use the k[tt]eypreview = True[/tt] in order to check for function keys etc. at a higher level so this may be worth having a look at too?

cheers
:)
Mark Saunders
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top