- Private Function HLW(rtb As RichTextBox, sFindString As String, Lcolor As Long)
- Dim LfoundPos As Long
- Dim LfindLenght
- Dim LorigSelStart
- Dim LorigSelLenght
- Dim ImatchCount As Integer
- LorigSelStart = rtb.SelStart
- LorigSelLenght = rtb.SelLength
- LfindLenght = Len(sFindString)
- LfoundPos = rtb.Find(sFindString, 0, , rtfNoHighlight)
- While LfoundPos > 0
- ImatchCount = ImatchCount + 1
- rtb.SelStart = LfoundPos
- rtb.SelLength = LfindLenght
- rtb.SelColor = Lcolor
- LfoundPos = rtb.Find(sFindString, LfoundPos + LfindLenght, , rtfNoHighlight)
- Wend
- rtb.SelStart = LorigSelStart
- rtb.SelLength = LorigSelLenght
- HLW = ImatchCount
- End Function
-
Private Function HLW(rtb As RichTextBox, sFindString As String, Lcolor As Long)
Dim LfoundPos As Long
Dim LfindLenght
Dim LorigSelStart
Dim LorigSelLenght
Dim ImatchCount As Integer
LorigSelStart = rtb.SelStart
LorigSelLenght = rtb.SelLength
LfindLenght = Len(sFindString)
LfoundPos = rtb.Find(sFindString, 0, , rtfNoHighlight)
While LfoundPos > 0
ImatchCount = ImatchCount + 1
rtb.SelStart = LfoundPos
rtb.SelLength = LfindLenght
rtb.SelColor = Lcolor
LfoundPos = rtb.Find(sFindString, LfoundPos + LfindLenght, , rtfNoHighlight)
Wend
rtb.SelStart = LorigSelStart
rtb.SelLength = LorigSelLenght
HLW = ImatchCount
End Function