DesktopTextControl.SelectionLength
From Xojo Documentation
Property (As Integer )
aDesktopTextControl.SelectionLength = newIntegerValue
or
IntegerValue = aDesktopTextControl.SelectionLength
New in 2021r3
Supported for all project types and targets.
or
IntegerValue = aDesktopTextControl.SelectionLength
New in 2021r3
Supported for all project types and targets.
The number of selected characters.
Notes
A SelectionLength of 0 means an insertion point rather than a selection. A value greater than the number of characters in the control means that the selection is from SelectionStart to the end of the control.
On Windows, selecting text via code does not display the text as selected unless the control has the focus. If you want this behavior, call SetFocus before setting the selection.
Example
This example selects the first 10 characters of TextArea1.
TextArea1.SelectionStart = 0
TextArea1.SelectionLength = 10
TextArea1.SelectionLength = 10