How could i auto select all the text in a textbox? Like when i click
in the box it would select all text.
Printable View
How could i auto select all the text in a textbox? Like when i click
in the box it would select all text.
text1.seltext=text1
VB Code:
Private Sub Text1_GotFocus() Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End Sub
Thanks, Now it will be so much easier to edit all 16 text boxes.
to make things easier:Quote:
Originally posted by Hack
VB Code:
Private Sub Text1_GotFocus() Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End Sub
VB Code:
'In a module Public Sub HighlightText(objControl As TextBox) With objControl .SelStart = 0 .SelLength = Len(.Text) End With End Sub 'In your form Private Sub Text1_GotFocus() HighlightText Text1 End Sub