Search Tools Links Login

Auto-Select Text on Focus


Visual Basic 6, or VB Classic

Nice feature to help users edit textboxes. The code selects all the existing text when the users focus on the textbox control. This will definitely make your application more user friendly. Please Vote!!!

Original Author: Delio Castillo

Inputs

Textbox Name

Assumptions

Copy this sub on your code and then use the textbox name as a parameter when you call the sub. When I use it, I usually call the SUB on the GotFocus event.

Code

Public Sub Select_Text(TextBoxName As Variant)
  TextBoxName.SelStart = 0
  TextBoxName.SelLength = Len(TextBoxName.Text)
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 105 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.