How to lose control of a textbox when clicking on it

I have a textbox in a window form. Currently the focus is on the text field and I am entering text. Now I am going outside the textbox, but inside the window. This action does not cause the text box to lose focus. The cursor is still blinking in the text box. If the click was on another control, the text box would lose control.

How can I make the textbox lose control when clicking on it (not only on another control, but also inside the form)?

Thanks in advance.

Datte

+2


a source to share


1 answer


Because you are clicking on a control that has no way of doing focus (like a form, shortcut, etc.). If you click, for example, in another text box, the focus should move.



To move focus programmatically (that is, on the form's OnClick event) use the control.Focus method.

+4


a source







All Articles