On any Win Form you can designate a Button control to be the accept button (also known as the default button). Whenever the user presses the ENTER key, the default button is clicked regardless of which other control on the form has the focus. (The exception to this is when the control with focus is another button — in that case, the button with the focus will be clicked.)
You can programmatically set a button as the default button.
To designate the accept button programmatically
[Visual Basic] Private Sub SetDefault(myDefaultBtn As Button) Set Me.AcceptButton = myDefaultBtn End Sub [C#]
Button Control | Selecting a Button Control Programmatically | Responding to Button Clicks | Accept Member | Designating a Button As the Cancel Button | AcceptButton Property