This method works but it's damn slow . It takes about 1 minute to colorize some keywords . I feel like there is a way to improve it and speed it up . Anyone has a solution or alternative method ?
VB Code:
Public Sub FindHighlight(ByVal Keywords As ArrayList, ByVal HighlightColor As Color) Me.SuspendLayout() Dim StartLooking As Integer = 0 Dim FoundAt As Integer Dim SearchLength As Integer For Each keyword As String In Keywords SearchLength = keyword.Length Application.DoEvents() Do FoundAt = Me.RichTextBox1.Find(keyword, StartLooking, RichTextBoxFinds.WholeWord) If FoundAt > -1 Then Me.RichTextBox1.SelectionColor = HighlightColor StartLooking = StartLooking + SearchLength Loop While FoundAt > -1 SearchLength = 0 FoundAt = 0 StartLooking = 0 Next Me.ResumeLayout() End Sub
btw , I'll not go with threading now .It's my last option , I think![]()
Thanks





Reply With Quote