Hello,
I have a customer who would like to press the enter key to submit a command. I have never programmed On Key Press. How would I program On Key Press so that when the customer presses the enter key, it performs a submit function?
I asked the user about that and they would like to be able to just hit the enter key and submit. I have been trying to find some information on KeyDown and KeyUp coding to see if that would help, but I have not found anything that helps.
I'm presuming you're in a Form when you want to trap ENTER. If you want to trap keys at form level you need to set the form KeyPreview property to true and add your code in one of the Key events.
But an easier way of doing this might be to have a default command button. If you have no other buttons on the form then pressing ENTER will be the same as clicking on the button.
That is what I am wanting to do. I have two buttons on the form a submit and a cancel. The submit checks for a true statement and then closes the form and the cancel clears the entries and closes the form.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.