Search Tools Links Login

Auto-Select Text on Focus

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


Textbox Name


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.


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: 90 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.