How to remove focus from one control?

In my C # WinForms program, I have a form on which there is only one Button control. By default, this Button control gains focus on the form. But I do not want Button to always focus.

Is there a solution, even one that would require an unmanaged API call?

+3
source share
2 answers

In the form, Loadyou can set the focus to some other control.

If you do not want the control to receive focus from the keyboard, you can also set its property TabStopto false.

, , TabIndex. TabIndex , , tab. TabIndex 0, .

TabIndex TabStop MSDN.

+7

TabStop

button1.TabStop = false;
+3

Source: https://habr.com/ru/post/1784663/


All Articles