Results 1 to 3 of 3

Thread: Text Box onFocus Highlight?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    What's it matter?
    Posts
    2

    Question

    I've probably seen this answer a hundred times today, but I haven't noticed. Here's the story, I have a text box, say Text1, that I want to highlight all of the text in it when the user tabs to it, it can also highlight when the user clicks in it, but it doesn't have to. Please tell me the (probably very simple) way to do this.
    Thanks!
    sketch2002
    A good program is always better if you wrote it!

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092
    Code:
    Private Sub Text1_GotFocus()
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
    End Sub
    that should do it.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    What's it matter?
    Posts
    2

    Cool Thanks!

    Thanks crptcblade, that was just what I needed; I knew that SelStart and SelLength looked important...
    A good program is always better if you wrote it!

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