Tag Archives: Gotfocus

Highlight Textbox Text on Focus in VB 6.0

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 2.00 out of 5)

Simple code snippet for Visual Basic 6.0 to highlight all of the text in a textbox control when receiving focus.

'textbox - GotFocus() Event

Private Sub Text1_GotFocus()

Text1.SelStart = 0

Text1 = SelLength = Len(Text1)

End Sub