Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Textbox - select all text on focus


Sub  SelectAll()
'Put this in the GotFocus event of a textbox
Me .ActiveControl.SelStart = 0
Me .ActiveControl.SelLength = Len( Me .ActiveControl.Text)
End Sub

'this is an alternative for a specific textbox
txtOut.SelStart = 0
txtOut.SelLength = Len(txtOut.Text)