Private Sub RichTextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox1.KeyPress
Dim iPos As Integer
Dim key As Char = e.KeyChar
Dim c() As Char = Mid(RichTextBox1.Text, iPos, 1)
If key.ToString() = c Then
MsgBox("OK")
RichTextBox1.SelectionStart = iPos
RichTextBox1.SelectionColor = Color.Blue
RichTextBox1.Focus()
Else
MsgBox(" not OK")
RichTextBox1.SelectionStart = iPos - 1
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.Focus()
End If
iPos += 1
End Sub