Results 1 to 2 of 2

Thread: Highlighting text when tabbing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2004
    Posts
    23

    Highlighting text when tabbing

    When my form loads, I want zero's in some of my textboxes (these are numeric fields that the user seldom inputs data into). I would like the zeros to be highlighted when the user tabs to that textbox so that the zero will be replaced by the user's input when they begin to type. Is there an easy way to do this?

    Thanks,
    bsac4
    New to VB

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Place this code in the GotFocus event (obviously change TextBox to the appropriate name).

    TextBox.SelStart=0
    TextBox.SelLength = Len(TextBox.Text)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width