TextBox.SelectAll () does not work with TAB

I use maskedTextBox.SelectAll() to highlight the text in MaskedTextBox in the Enter and MouseDown .

It works when I use the mouse, but I go to this text box by pressing the Tab key, this does not work.

What am I missing here?

0
source share
1 answer

Have you tried the GotFocus event?

When you change focus using the keyboard (TAB, SHIFT + TAB, etc.), calling the Select or SelectNextControl methods or setting the ContainerControl.ActiveControl property to the current form, the focus events occur in the following order:

He will then list the events that were triggered. This seems to work when the mouse is in use, so you may only need this handler.

+2
source

Source: https://habr.com/ru/post/982714/


All Articles