Solved

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

Posted on 1998-06-19
2
183 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

831 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