|
-
Apr 26th, 2006, 03:31 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Fire a event with a key combination
Hi!
I want to call some functions when a combination of key is pressed. But I don't know what is the event that I can track this combination.
-
Apr 26th, 2006, 04:13 AM
#2
Re: Fire a event with a key combination
Trap KeyDown event, and you will also need to set the KeyPreview property of the form true.
Actually the information provided is too little. If you can elaborate as to what you are actually looking for it would be easier to help.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Apr 26th, 2006, 04:37 AM
#3
Fanatic Member
Re: Fire a event with a key combination
If you want to be able to trap the key sequence even when your form does not have focus you should register a HotKey or use the GetAsyncKeystate API to detect which keys are being pressed
-
Apr 26th, 2006, 04:54 AM
#4
Re: Fire a event with a key combination
Set the KeyPreview property of the Form to true. And then use this code
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyS And Shift = 2 Then
'call your save function here
End If
End Sub
Remember you will have to call the Save Function code from within the If Condition.
Use [code] source code here[/code] tags when you post source code.
My Articles
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|