In my C# WinForms program, I have a form that has only a single Button control on it.
By default, that Button control receives the focus on the form. But I don’t want the Button to ever get focus.
Is there a solution, even one that would require a call to an unmanaged API?
In your form
Loadevent you can set the focus on some other control.If you do not want the control to ever get focus via keyboard, you can also set its
TabStopproperty to false.If you want that the button should not have focus when you open the form, then you need to correct the
TabIndexproperty. TheTabIndexproperty has an integer as value which specifies the order in which the controls get focus whentabkey is pressed. If the control hasTabIndexset to 0 then change it to some other value.Check the documentation for TabIndex and TabStop properties on MSDN.