• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

textbox on tab select entire text

vb 2005

when i tab through textboxes, i'd like to have the whole text in the textbox selected when it gets focus.

  • 2
1 Solution
Fernando SotoRetiredCommented:
Hi newyuppie;

Place an event handler for the TextBox Get Focus event and attach all text boxes to it and inset the line of code below.

    Private Sub TextBox_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles TextBox1.GotFocus, TextBox2.GotFocus, TextBox3.GotFocus

        CType(sender, TextBox).SelectAll()

    End Sub

newyuppieAuthor Commented:
very good that works fine. thank you!
Fernando SotoRetiredCommented:
Glad I was able to help. :=)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now