到目前为止,我已经能够为整个文本编写查找和替换代码。
Private Sub btnFFindNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFFindNext.Click
Dim search As String
Dim length As String
search = textToFind.Text
length = textToFind.Text.Length
lastposition = RichTextBox.Find(textToFind.Text, lastposition, RichTextBoxFinds.None)
RichTextBox.SelectionStart = lastposition
RichTextBox.SelectionLength = length
lastposition = lastposition + 1
但是,我现在需要使它成为可能,以便如果用户选择一些文本,则仅对该选择执行查找和替换。
我该怎么做呢?