Dim in1 As Integer = 0
Dim in2 As Integer = 0
Dim inn3 As Integer = RichTextBox1.SelectionStart
For i = 0 To RichTextBox1.Lines.Length - 1
in2 = in2 + RichTextBox1.Lines(i).Length
If inn3 > in1 And inn3 < in2 Then
RichTextBox1.Select(in1 + i, RichTextBox1.Lines(i).Length + 1) RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionLength = 0
Else
RichTextBox1.Select(in1 + i, RichTextBox1.Lines(i).Length + 1) RichTextBox1.SelectionColor = Color.Black
RichTextBox1.SelectionLength = 0
RichTextBox1.SelectionStart = inn3
End If
in1 = in1 + RichTextBox1.Lines(i).Length
Next