VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > EditSelText Property |
Returns or sets the string containing the current selection in the editor.
[form!]VSFlexGrid.EditSelText[ = value As String ]
This property works in conjunction with the EditSelStart and EditSelLength properties, while the control is in cell-editing mode.
Use these properties for tasks such as setting the insertion point, establishing an insertion range, selecting sub-strings in the editor, or clearing text. Used in conjunction with the Visual Basic Clipboard object, these properties are useful for copy, cut, and paste operations.
Notes
1. Setting SelLength less than 0 causes a runtime error.
2. Setting SelStart greater than the text length sets the property to the existing text length.
3. Changing SelStart changes the selection to an insertion point and sets SelLength to 0.
4. Setting SelText to a new value replaces the selected text with the new string and sets SelLength to 0.
The following code replaces characters 6 through 8 with the word "COW" whenever a cell is clicked.
Private Sub fg_Click()
fg.EditCell
fg.EditSelStart = 5
fg.EditSelLength = 3
fg.EditSelText = "COW"
End Sub
String