开发者

TextBox.SelectAll() does not work with TAB

开发者 https://www.devze.com 2023-01-06 19:50 出处:网络
I am using maskedTextBox.SelectAll() to highlight the text in the MaskedTextBox in the En开发者_如何学Goter and MouseDown events.

I am using maskedTextBox.SelectAll() to highlight the text in the MaskedTextBox in the En开发者_如何学Goter and MouseDown events.

It works when I use the mouse, but I go to that textbox by pressing the Tab key, it does not work.

What am I missing here?


Have you tried the GotFocus event?

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

It then goes on to list the events that are fired. It looks like this fires when the mouse is used so you might only need this handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消