Hi All!
I'm trying to implement Find/Replace Functionality in by application that uses The SharpDevelop textEditor Control as it's main editor. I Have Found the following code For Find:
Dim
StartPosition As IntegerDim SearchType As CompareMethod
If chkMatchCase.Checked = True Then
SearchType = CompareMethod.Binary
Else
SearchType = CompareMethod.Text
End If
StartPosition = InStr(1, frmMain.rtbDoc.Text, txtSearchTerm.Text, SearchType)
If StartPosition = 0 ThenMessageBox.Show("String: " & txtSearchTerm.Text.ToString() & " not found", "No Matches", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Exit Sub
End If
frmMain.rtbDoc.Select(StartPosition - 1, txtSearchTerm.Text.Length)
frmMain.rtbDoc.ScrollToCaret()
frmMain.Focus()
and the following for replace:
If
frmMain.rtbDoc.SelectedText.Length <> 0 Then
frmMain.rtbDoc.SelectedText = txtReplacementText.Text
End IfDim StartPosition As Integer = frmMain.rtbDoc.SelectionStart + 2
Dim SearchType As CompareMethod
If chkMatchCase.Checked = True Then
SearchType = CompareMethod.Binary
Else
SearchType = CompareMethod.Text
End If
StartPosition = InStr(StartPosition, frmMain.rtbDoc.Text, txtSearchTerm.Text, SearchType)
If StartPosition = 0 ThenMessageBox.Show("String: '" & txtSearchTerm.Text.ToString() & "' not found", "No Matches", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Exit Sub
End If
frmMain.rtbDoc.Select(StartPosition - 1, txtSearchTerm.Text.Length)
frmMain.rtbDoc.ScrollToCaret()
frmMain.Focus()
However these only work on richTextBox Controls and not on a TextEditor Control, Can Somebody help me tweak this code so that it workd with #Develop's TextEditorControl?
Thanks!
SmileyWolf