I tab out from a TextBox and then get an error message due a some validation failure. I press the 'Ok' button acknowledging the error message. Then focus goes on to the next control. How can we have the focus remain on the original TextBox after error has been acknowledged?
Asked
Active
Viewed 143 times
0
-
1Post relevant code please – Sriram Sakthivel May 13 '14 at 06:57
-
possible duplicate of [WPF and initial focus](http://stackoverflow.com/questions/817610/wpf-and-initial-focus) – Gul Ershad Jul 07 '15 at 17:17
1 Answers
2
Assuming your text box name txtMybox, you can set the focus of the textbox as follows
txtMybox.Focus()

Haseeb Asif
- 1,766
- 2
- 23
- 41