All I want to do is to search a RichTextBox's text using a Regular
Expression.
I've tried it using the tom interface but can't make it work.
Below is a little of the code.
I've tried another NG and concluded no one knew how.
This NG is great, I've gotten fantastic answers to almost every question
I've asked, except those that relate to the RichTextBox. So I assume no one
here is doing hardcore stuff with it, but I thought I'd try.
What does hth mean?
Thanks for asking for more input.
Dim IDocument As tom.ITextDocument =
GetCtlEdit(Me).TextControl1.GetOLEInterface()
-snip
If chkWholeWords.Checked Then lFlags = RichEdit.Flags.MatchWord
If chkMatchCase.Checked Then lFlags = lFlags Or RichEdit.Flags.MatchCase
If chkRegularExpressions.Checked Then lFlags = lFlags Or
RichEdit.Flags.MatchPattern
Select Case aFindType
Case gFIND_FROM_THE_END
lSearchRange = GetCtlEdit(Me).TxtRangeAll
lintFoundPos = FindText(lSearchRange,
cboFindStr.Text, -lSearchRange.StoryLength, lFlags)
Case gFIND_FROM_THE_START
--snip
Private Function FindText(ByRef aRange As tom.ITextRange, ByVal aFindString
As String, ByVal aCount As Integer, ByVal aFlags As Integer) As Integer
If aCount = 0 Then
FindText = 0
Else
If aCount < 0 Then
FindText = aRange.FindTextEnd(aFindString, aCount, aFlags)
If FindText > 0 Then aRange.Start = aRange.End - FindText
Else
FindText = aRange.FindTextStart(aFindString, aCount, aFlags)
If FindText > 0 Then aRange.End = aRange.Start + FindText
End If
End If
End Function