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

creating shortcut keys- F1 for 2004

Status
Not open for further replies.

shanmugham

Programmer
Jun 19, 2001
71
0
0
IN
Dear Friends,

I am currently developing an application and was wondering how to create a shortcut key which is accessible from particualr form of my tool. Basicly, I want to register F1 to "2004", do a 2004 action. The user should be able to press F1 from a form and the action should execute.

thanks in advance
Regards,

shan

 
hi
set form keypreview property to true value
then you can use the following code:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'the keycode for F1 is 112
If KeyCode = 112 Then
'Your code goes here (2004 action)
End If
End Sub

regards
 
Just in case you don't know, though... F1 is the standard shortcut for Help in Windows apps. You may want to consider a different key so your users don't hit your "2004" key when they want help.
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 112 Then
2004
End If
End Sub

how to assign the text 2004

thanks

shan
 
hi
Genimuse
when your application is active_window the F1 will not work as a system shortcut to help unless you had assigned it to do so (most programmers assign this button to take user to help menu to keep their app's shortcuts familier to windows shortcut)

shanmugham
how to assign the text 2004
what you mean by assign the text 2004 ,,, is 2004action a function or you just you want to set this text in somewhere in your form
more explaination will be helpfull

regards
 
that is just like cut and paste type,

in any place of the textbox during the run time (at the time of entry part)

ony the string 2004 will place it. (just like paste type)

not only F1 may be any one functional keys

regards

shanmugham
 
I agree with WFadloun

F1 is universally "HELP" in windows programs. If you go agianst this you make your applications learning curve more difficult. It would be just like you make the key combination for Cut to Alt-Y.

Do you just want anywhere in your application when a user hits F1 to put the string "2004" in? I'm a bit confused by your statement "do a 2004 action"



Hope I've been helpful,
Wayne Francis

If you want to get the best response to a question, please check out FAQ222-2244 first
 
WFoudlon said: "Genimuse
when your application is active_window the F1 will not work as a system shortcut to help unless you had assigned it to do so (most programmers assign this button to take user to help menu to keep their app's shortcuts familier to windows shortcut)"


Uhh... yeah. But that has nothing to do with my point, which was that Windows users expect applications -- note my use of the words "Windows apps" -- to assign help to F1. Which you repeated to me.

I didn't say or even hint that F1 would magically make help for your application appear, or that it would somehow mystically make Windows system help appear. Only that it was the standard key for Help, and that if the guy makes it do something else then he's going to confuse his users.
 
thanks

F1 through F12 any one key enough

thanks

shan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top