Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub AddHighlight(ByRef RichTextBox As RichTextBox, ByVal Command As String, ByVal color As Color)
- If RichTextBox.Text.Length > 0 Then
- Dim selectStart As Integer = RichTextBox.SelectionStart
- LockWindowUpdate(RichTextBox.Handle.ToInt32)
- 'RichTextBox.Select(0, RichTextBox.Text.Length)
- 'RichTextBox.SelectionColor = color.Black
- 'RichTextBox.DeselectAll()
- Dim pos As Integer = 0
- Do While RichTextBox.Text.ToUpper.IndexOf(Command.ToUpper, pos) >= 0
- pos = RichTextBox.Text.ToUpper.IndexOf(Command.ToUpper, pos)
- RichTextBox.Select(pos, Command.Length)
- RichTextBox.SelectionColor = color
- pos += 1
- Loop
- RichTextBox.SelectionStart = selectStart
- RichTextBox.SelectionLength = 0
- LockWindowUpdate(0)
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement