Reputation: 33
I'm working on a form that has two main buttons, "OK" and "Cancel". I have set the "Accept Button" property of the form to be the "OK" button.
Goal: I would like the "OK" button to be default, so that when the form is opened the "OK" button is highlighted and initiates if the enter key is pressed.
Problem: When the form loads, the "Cancel" button is highlighted, until the user clicks anywhere in the form, then the "OK" button becomes highlighted.
Any suggestions?
Upvotes: 1
Views: 8499
Reputation: 5445
Set the ActiveControl property to the OK Button in the Form_Load:
this.ActiveControl = OkButton
Upvotes: 11