Textbox select all content when tabbed

  • Thread starter Thread starter Kenny
  • Start date Start date
K

Kenny

I have two textboxes in my windows form. When i switch between the
textboxes by using the tab-button, i want the content of the next
textbox to be completely selected so that i can start typing it over
right away. How can i do this?

All help appreciated.
 
Kenny said:
I have two textboxes in my windows form. When i switch between
the textboxes by using the tab-button, i want the content of the
next textbox to be completely selected so that i can start typing it
over right away. How can i do this?

In the Enter event:

directcast(sender, textbox).selectall

You can use the same procedure to handle the Enter event of both textboxes.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
* (e-mail address removed) (Kenny) scripsit:
I have two textboxes in my windows form. When i switch between the
textboxes by using the tab-button, i want the content of the next
textbox to be completely selected so that i can start typing it over
right away. How can i do this?

That's the default behavior, at least on Windows XP Professional.
 
Try entering and deleting the text in a text box and tab to and from it,
then it won't auto-select the entire text.
 
* "CT said:
Try entering and deleting the text in a text box and tab to and from it,
then it won't auto-select the entire text.

Thank you for making me aware of that. This will occur if you changed
the text of the textbox.

Solution: Add a handler to the textbox's 'GocFocus' event (you will
have to create this handler yourself because it's not listed in the
list of available events) and enter this code:

\\\
DirectCast(sender, TextBox).SelectAll()
///
 
Back
Top