I had a need to get the position of the cursor on a particular line in the RadRichTextBox. To do that, I added a selection from the start of the current line to the caret position, and got the length of the selected text, as follows:
iCol As Integer = 1
Dim oCaretPos As DocumentPosition = oRadRTB.Document.CaretPosition
Dim oStartPos As DocumentPosition = New DocumentPosition(oCaretPos)
iCol = oRadRTB.Document.Selection.GetSelectedText().Length + 1
Once I get that value (iCol), I want to clear the selection I just added. When I call Document.Selection.Clear(), it clears all selections. What this means is that if the user selectes text, that that selection is cleared along with my programmatic selection.
Is there a way to clear my programmatic selection without clearing the user's selection? Can I iterate through selections, for instance, and remove individual ones?