Just made a test with Windows Forms...
Does _not_ set focus on the button of my choice:
private void FormMain_Load(object sender, EventArgs e)
{
buttonTestHttpClient.Focus();
}
This works and sets the focus on the button of my choice:
private void FormMain_Load(object sender, EventArgs e)
{
this.ActiveControl = buttonTestHttpClient;
}
[Edit] Works also for me
private void FormMain_Load(object sender, EventArgs e)
{
buttonTestHttpClient.Select();
}
[Edit 1]
See also here, especally the 'Note':
Control.Focus Method (System.Windows.Forms) | Microsoft Docs[
^]
Note
Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.
I hope it helps.