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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anything like "On Key Label" in VB? 1

Status
Not open for further replies.

JeffCarlin

Programmer
Aug 16, 2001
33
US
When I used to program in FoxPro, there was a function named "On Key Label", which, when defined, would make a keystroke combination execute a particular piece of code throughout the app. You would declare it in "sub main" and it would work everywhere. For example:
"ON KEY LABEL F12 DO some_code"

Does VB have anything like this?

Thanks,
Jeff
 
Use the Keypress() or KeyDown() events, either at the Form level or individual control level.

By default, the individual control receives the keystroke event first. Change the .KeyPreview property of the form to True to trap the key at the form level first.

You can also make it so that the form receives the keystroke and the control does not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top