Q110394 article
Add the following code to the Text1 GotFocus event:
Sub Text1_GotFocus ()
text1.SelStart = 0 ' Start selection at beginning.
text1.SelLength = Len(text1.Text) ' Length of text in Text1.
End Sub
------------------------- Extra informatin about properties
Syntax of SelLength, SelStart, and SelText Properties
The SelLength, SelStart, and SelText properties apply to combo boxes and text boxes, and behave as follows:
SelLength determines the number of characters selected.
SelStart determines the starting point of text selected. SelStart indicates the position of the insertion point if no text is currently selected.
SelText determines the string containing the currently selected text; consists of an empty string ("") if no characters are currently selected.
The SelLength, SelStart, SelText properties are not available at design time. They are only available at run time. They have the following syntax:
[form.]{combobox|textbox}.SelLength[ = length ]
[form.]{combobox|textbox}.SelStart[ = index ]
[form.]{combobox|textbox}.SelText[ = stringexpression ]
DougP, MCP, A+