473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

HotKeys in VB6

Ali Rizwan
925 512MB
Hi
How to assign hotkey to any command
Aug 27 '07 #1
10 13651
hariharanmca
1,977 1GB
Hi
How to assign hotkey to any command
If the Command Text Or Caption is "Click ME" and you want assigen M as Hot Key then change the caption to "Click &ME"
Aug 27 '07 #2
If the Command Text Or Caption is "Click ME" and you want assigen M as Hot Key then change the caption to "Click &ME"
I'm trying to do the same thing. But i want things to execute when someone say presses F1. I'm guessing that works different?
Aug 27 '07 #3
hariharanmca
1,977 1GB
I'm trying to do the same thing. But i want things to execute when someone say presses F1. I'm guessing that works different?

1. Make Form Keypreview = True
2. In Form Key Down Event

Expand|Select|Wrap|Line Numbers
  1. If KeyCode = vbKeyF1 then     Command1_Click
Aug 27 '07 #4
1. Make Form Keypreview = True
2. In Form Key Down Event

Expand|Select|Wrap|Line Numbers
  1. If KeyCode = vbKeyF1 then     Command1_Click
Cheers.

Helped alot.
Aug 27 '07 #5
I've tried it, but it doesn't work...
Could you post the whole code please :)
Oct 23 '08 #6
debasisdas
8,127 Expert 4TB
kindly post what you have tried.
Oct 23 '08 #7
I've tried this... But it didn't work

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  2. KeyPreview = True
  3. If KeyCodeConstants = vbKeyF1 Then Command1_Click
  4. If KeyCodeConstants = vbKeyF2 Then Command2_Click
  5. If KeyCodeConstants = vbKeyF3 Then Command3_Click
  6. If KeyCodeConstants = vbKeyF4 Then Command4_Click
  7. If KeyCodeConstants = vbKeyF5 Then Command5_Click
  8. If KeyCodeConstants = vbKeyF6 Then Command6_Click
  9. End Sub
I've tried KeyCode instead of KeyCodeConstants at first, but I tried to change it to this...
Oct 24 '08 #8
debasisdas
8,127 Expert 4TB
KeyPreview is a property of the form. You need to set that.
can be set at design time.
Oct 24 '08 #9
So

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. KeyPreview = True
  3. End Sub
  4.  
It works!! :)
Thanks :)
Oct 24 '08 #10
you also need to click on the form and change the key preview to true.



Private Sub Form_Load()
KeyPreview = True
If hotkey = vbKeyF1 Then Command1_Click
End Sub
Jun 16 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: skumar | last post by:
I need to access the Tabpages by hotkeys "alt+P" in case of "Principals" as one of the Tabpage. Also i need to underline the word "P" in "Principals" so that user is informed about the hotkey.If...
2
by: Hasan Ammar | last post by:
Is it possible to set up hotkeys using onkeypress? I know it can be done with the usual alphanumeric keys, but what about function keys? or using ctrl/alt combinations? Does anybody have a...
1
by: Matthew Wells | last post by:
How do you prevent someone from using Ctrl+, (ctl + comma) or Ctl + . (Ctl + perios) to get to design view. I have all the normal properites turned off (Access special keys, F!!, etc) but nothing...
3
by: Matthew Wells | last post by:
I'm reposting because an idiot replied without reading the whole message. I've tried autokeys and it isn't working for this combination. Please read on. While in form view, how do you prevent...
2
by: Jason Duncan | last post by:
I have a C# WinForm application (.net 1.0). On my Menu and Buttons I use the '&' (in the .Text properties) for Hotkey access. No biggie. The strange behavior is that the '&' is converted to the...
2
by: Martin Hjärtmyr | last post by:
I have a program that uses Hotkeys! And they works just fine! I use this hotkeylib:...
3
by: Bernd Eichelsdorf | last post by:
Hi, I would like to add hotkeys to my webapp - it's running on a barcode scanner, that has got a number pad and the keys F1 - F4. I would like to add hotkeys, so that when the user presses F1,...
2
by: =?Utf-8?B?SXZvODY=?= | last post by:
Hi, I need ot set hotkeys to my windows application. I want when Word is thea active application and when user press "Ctrl+Alt+T" for example to start my action. I used RegisterHotKey and...
0
by: Octavius Khan | last post by:
How can I set system hotkey that will only work for specific applications. For example, I have a system tray application that uses hotkeys to perform certain tasks like placing text into a memo...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.