I want to select all the text in a textbox when it gets focus. Having touble finding that info.
Tim VB6, SP4 GT Vengeance
txtField.SelStart = 0 txtField.SelLength = Len(txtField.Text) Try this in your gotfocus event...
Code: Public Sub gSelectText(txtText As TextBox) On Error Resume Next txtText.SelStart = 0 txtText.SelLength = Len(txtText) End Sub on the GotFocus-event, call this procedure, like this:; Code: Private Sub Text1_GotFocus() Call gSelectText(Text1) End Sub
Public Sub gSelectText(txtText As TextBox) On Error Resume Next txtText.SelStart = 0 txtText.SelLength = Len(txtText) End Sub
Private Sub Text1_GotFocus() Call gSelectText(Text1) End Sub
Reality is what you make up when you can't handle your fantasies.
Thank you both, works great! I knew there was something simple.
Forum Rules