I have a User-Control
with 2 Textbox
and 1 Button
, Something like below:
When I press the button a form show and when the form closed I want to leave focus from User-Control
and next control on the Form
got focus, I write this code for this issue:
private void Btn_Select_Click(object sender, EventArgs e)
{
if (t.ShowDialog() == DialogResult.OK)
ProcessTabKey(true);
}
I excepted that next control on the Parent Form got focus BUT the textbox on UserControl
got focus, I change the TabStop
property to false
for 2 textbox
but still have the problem.
Could anyone know how I solve this problem?
Use:
this.FindForm().SelectNextControl(this, true, true, true, true);
Instead Of:
UserControl.ProcessTabKey();
Will Solve Problem.