Returns the starting point of a text selection made by the user in a text-entry area of a control, or indicates the position of the insertion point if no text is selected. Also, specifies the starting point of a text selection in a text-entry area of a control. Not available at design time; read/write at run time.
[Form.]Control.SelStart[= nStart] |
Return Value
- nStart
- Specifies the starting point of text selected or indicates the position of the insertion point if no text is selected. Selected text appears shaded. The valid range of settings is 0 to the total number of characters in the edit area of the control.
Remarks
Applies To: ComboBox | EditBox | Spinner | TextBox
Use this property with the SelLength and SelText properties for tasks such as:
-
Setting the insertion point within a string of characters.
-
Establishing an insertion range that limits where the insertion point can go.
-
Selecting a specific group of characters (substrings) in a control.
-
Clearing text.
When working with these properties, be aware of the following behaviors:
-
Setting SelLength to less than 0 causes a run-time error.
-
Setting SelStart to greater than the text length sets the property to the existing text length. Changing SelStart changes the selection to an insertion point and sets SelLength to 0.
-
Setting SelText to a new value sets SelLength to 0 and replaces the selected text with the new string.