I have a DataGridView component on a form. How do I set the focus to this component so that it responds to arrow keys?
You could:
dataGridView.Select();
or
dataGridView.Focus();
Alternatively, you could set the ActiveControl property:
ActiveControl = dataGridView;
The following text came from Microsoft
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With