Results 1 to 3 of 3

Thread: Highlight Text RESOLVED

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Resolved Highlight Text RESOLVED

    How could i make it so when i tab between text boxes,which ever textbox has focus makes it highlight the text
    Last edited by Ricky1; Sep 29th, 2005 at 05:10 AM.
    Im Learning !!!!

  2. #2
    Addicted Member Screamager's Avatar
    Join Date
    May 2001
    Location
    Dublin, Ireland
    Posts
    174

    Re: Highlight Text

    VB Code:
    1. Private Sub Text1_GotFocus()
    2.     Text1.SelStart = 0
    3.     Text1.SelLength = Len(Text1.Text)
    4. End Sub
    Computer /nm./: a device designed to speed and automate errors

  3. #3
    Fanatic Member eimroda's Avatar
    Join Date
    Jul 2000
    Location
    Philippines
    Posts
    642

    Re: Highlight Text RESOLVED

    just a tip: this is the way i use it...

    VB Code:
    1. 'in a module...
    2. Sub HiLite(myText as TextBox)
    3.      myText.SelStart = 0
    4.      myText.SelLength = Len(myText.Text)
    5. End Sub
    6.  
    7. 'then call it in a TextBox's GotFocus event:
    8. Private Sub Text1_GotFocus()
    9.      HiLite Text1
    10. End Sub

    this is helpful when you're dealing with multiple textboxes...
    or better use control array so you are going to call the gotfocus event only once for al the textboxes.
    On Error GoTo Hell

    Hell:
    Kill Me


    Food For Thought:

    - Do not judge a book... if you're not a judge!


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