I have a textbox on dialog form, I want to default focus on it once form load, but for some reason, it does not happen. I have tried: Focus and form_load event and put focus method right after initialization of form.
You may call Control.Focus()
method in Dialog Form's Activated
event handler or set Tab Index order or use Select()
method.
Use Form Shown event instead Load. Control cannot get focus while form doesn't shown.
public partial class Form1 : Form
{
private void Form1_Shown(object sender, EventArgs e)
{
textBox1.Focus();
}
}
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