Home » c# » Default button property in winform app

Default button property in winform app

Posted by: admin November 29, 2017 Leave a comment

Questions:

I have a form that takes user input and then let the user get connected to the sql server.
This is happening on button click.But where can I set the property Default button so that the user when clicks enter do the work of that button.

Answers:

It is called AcceptButton now on the form; set that to the button that will be the default button.
Refer to Form.AcceptButton Property

Questions:
Answers:

I think you want the “AcceptButton” property at the FORM level… That will expose a combobox of available controls on your form, then select your “button” you want to use as the “Default” button on enter.