textbox on tab select entire text

Posted on 2006-06-04
Last Modified: 2010-04-23
vb 2005

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

Question by:newyuppie
    LVL 62

    Accepted Solution

    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

    LVL 13

    Author Comment

    very good that works fine. thank you!
    LVL 62

    Expert Comment

    by:Fernando Soto
    Glad I was able to help. :=)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Suggested Solutions

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now