the error is coming from highlight sub for richtextbox:
Highlight(Color.FromArgb(57, 135, 214), 0, "MOTOR")
Highlight(Color.FromArgb(57, 135, 214), 0, "SCALLING")
Highlight(Color.FromArgb(57, 135, 214), 0, "VALVE")
Highlight(Color.Green, 0, "inputVariable")
Highlight(Color.DarkOrange, 0, "outputVariable")
Highlight(Color.Red, 0, "<descriptionFFB execAfter=")
Highlight(Color.DarkRed, 1, "<FBDExchangeFile>")
Highlight(Color.DarkRed, 1, "</FBDExchangeFile>")
Highlight(Color.DarkRed, 1, "</FFBBlock>")
Highlight(Color.DarkRed, 1, "<FFBBlock>")
Public Function Highlight(ByVal highlightcolor As System.Drawing.Color, ByVal fontstyle As FontStyle, ByVal WordsToFind As String)
Dim FoundAtPosition As Integer
If WordsToFind IsNot Nothing Then
FoundAtPosition = GenCodeText.Find(WordsToFind, RichTextBoxFinds.None)
Do Until FoundAtPosition < 0
GenCodeText.SelectionColor = highlightcolor
GenCodeText.SelectionFont = New Font("tahoma", 8, fontstyle)
FoundAtPosition = GenCodeText.Find(WordsToFind, FoundAtPosition + 1, RichTextBoxFinds.None)
Loop
End If
this sub is highlighting around 1000 words inside my text"GenCodeText"....sometimes it is working and sometimes it is not......if i minimize the my text.....this error completely unseen.
so is there any way to exclude this error or to stop highlighting if it will happen or is there another better way to highlight inside RichTextBox.