I want to select all the text in a textbox when it gets focus. Having touble finding that info.
Printable View
I want to select all the text in a textbox when it gets focus. Having touble finding that info.
txtField.SelStart = 0
txtField.SelLength = Len(txtField.Text)
Try this in your gotfocus event...
on the GotFocus-event, call this procedure, like this:;Code:Public Sub gSelectText(txtText As TextBox)
On Error Resume Next
txtText.SelStart = 0
txtText.SelLength = Len(txtText)
End Sub
Code:Private Sub Text1_GotFocus()
Call gSelectText(Text1)
End Sub
Thank you both, works great! I knew there was something simple.