i've created a program which will compare 2 richtextboxes;where will highlight the line error in both richtexbox.the programme can be run;but the last line doesnt being highlight...e.g: there are 6 errors,but only 5 errors being highlighted,and the sixth line cannot be highlighted.does someone know where my mistakes are?below is my COMPARE programmes :~
Dim i As Integer, startindex As Integer = 0
Dim where As String, array1() As String = richtextbox1.Lines, array2() As String = RichTextBox2.Lines
For i = 0 To UBound(array1)
If String.Compare(array1(i), array2(i), False) = 0 Then
RichTextBox3.Text = RichTextBox3.Text & " ****************** " & vbNewLine
ElseIf String.Compare(array1(i), array2(i), True) = 1 Then
RichTextBox3.Text = RichTextBox3.Text & "error line " & "(" & i + 1 & ")" & " : " & array1(i) & vbNewLine
Dim endindex As Integer = array1(i).Length
where = InStr(richtextbox1.Text, array1(i))
richtextbox1.SelectionColor = Color.DeepPink
richtextbox1.Select(startindex, endindex)
richtextbox1.SelectionStart = where - 1
richtextbox1.SelectionLength = Len(array1(i))
ElseIf String.Compare(array2(i), array1(i), True) = 1 Then
RichTextBox3.Text = RichTextBox3.Text & "error line " & "(" & i + 1 & ")" & " : " & array2(i) & vbNewLine
Dim endindex2 As Integer = array2(i).Length
where = InStr(RichTextBox2.Text, array2(i))
RichTextBox2.SelectionColor = Color.Yellow
RichTextBox2.Select(startindex, endindex2)
RichTextBox2.SelectionStart = where - 1
RichTextBox2.SelectionLength = Len(array2(i))
End If
Next i