Solved

How do I change a button from being controlled by the mouse click to a keystrok

Posted on 1998-06-19
2
194 Views
Last Modified: 2012-05-04
I am trying to create a way to make something execute from a keystroke.  My idea is create
a command button and then figure out a way to make the command button work by pushing
for instance cntrl & t instead of clicking on it with the mouse.  Once this is done I can hide
the command button on the form and the function will work.
0
Comment
Question by:kellyegg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Expert Comment

by:jjmartin
ID: 1463839
There is no need to create a hidden button.  On your form, set the keypreview proporty to true.  Then in the keydown event of that form, put in the code that will check for the specific keys you want.
0
 

Accepted Solution

by:
electrick earned 30 total points
ID: 1463840
jjmartin's comment is true, although if you want to
use a command button, you can set it's Default property to True
then as long as it has focus the "Enter" key will trigger the
Click event.  It MUST have focus to work though.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question