Dear All,
How to invoke a button click event when pressing the Enterkey in any of the controls in a Form
Printable View
Dear All,
How to invoke a button click event when pressing the Enterkey in any of the controls in a Form
Read http://www.thescripts.com/forum/thread254554.html it gives some clues...
A word of advice: Create a form and place a button on it. Go to the Properties for the form and read the names and descriptions of all of the properties. Then, select the button and read the names and descriptions of all of the properties. I believe that once you do this, you will have a much better understanding of how things work. It will also answer your question.
Then enlight us!!!! :mad:
Arrogant attitude leads nowhere... :thumbd:
I'm not being arrogant, and I apologize if you took it that way.
If you look at the properties of a Form, you'll find a section called "Misc". Under that section, there are two properties called "AcceptButton" and "CancelButton". If you select "AcceptButton", the description at the bottom says "The accept button of the form. If this is set, the button is 'clicked' whenever the user presses the 'ENTER' key. Similarly, the "CancelButton" description says that the button is associated with the "ESC" key.
The point of what I said was that you can find out a lot of things by examining the properties of the controls you are using. I often find out things that I would never have known this way. For example, there's the DialogResult property on a button that makes it so you can create custom user prompt dialogs without having to write any form code. I would never have known about this if I hadn't taken a close look at the Button properties.