If you’re new to Visual Studio and programming in VB.net form app, you might not know that there is a simple way to make the Enter key perform an action.

Here I have an app that will grab the current uptime of a workstation remotely. The user enters a computer name in the top field, then clicks “Get Uptime” where the system uptime is displayed in the lower box. How do I get the app to take the “Enter” key to perform the action of the “Get Uptime” button though?

Fortunately, you can simply go to the “Properties” of your form, and in the “Misc” section, there is an option called “AcceptButton“. I simply set this to the button (Button1) that performs the action to submit the data for the form, and now the user can use the “Enter” key to submit the form.

Leave a comment

Your email address will not be published. Required fields are marked *