I need to remove the focus from several TextBoxes. I tried using:
textBox1.Focused = false;
Its ReadOnly
property value is true
.
I then tried setting the focus on the form, so as to remove it from all the TextBoxes, but this also fails to work:
this.Focus();
and the function returns false
when a textbox is selected.
So, how do I remove the focus from a TextBox?
You need some other focusable control to move the focus to.
Note that you can set the Focus to a Label. You might want to consider where you want the [Tab] key to take it next.
Also note that you cannot set it to the Form. Container controls like Form and Panel will pass the Focus on to their first child control. Which could be the TextBox you wanted it to move away from.