Hello, i am very new to vb 2005 and i need your help.
I have two textboxes on a form, the first named tb1 and the second tb2. The tb1 has a standart text at runtime and the users types in tb2 what they see in tb1.
I have a piece of code:
Private Sub Tb2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tb2.TextChanged
Dim i As Integer
Dim mistakes As Integer
mistakes=0
For i = 0 To Tb2.Text.Length - 1
If Tb2.Text.Length <> Tb1.Text.Length Then
If Tb2.Text(i) <> Tb1.Text(i) Then
mistakes = mistakes + 1
Else
Tb2.ForeColor = Color.Black
End If
End If
Next i
End Sub
This coce checks for mistakes in tb2 while the user types. Well, if the user types a mistake letter i want it to be red color but only the mistake letter not entire the text. So if for example the user does 3 mistakes i want only the three mistake letters to be red. Is it possible to do it? And how? I think i am missing something after the statement mistakes=mistakes+1 but what exactly? Any help will be much appreciated.
Thanks everyone
in advanced FemPro.
I have two textboxes on a form, the first named tb1 and the second tb2. The tb1 has a standart text at runtime and the users types in tb2 what they see in tb1.
I have a piece of code:
Private Sub Tb2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tb2.TextChanged
Dim i As Integer
Dim mistakes As Integer
mistakes=0
For i = 0 To Tb2.Text.Length - 1
If Tb2.Text.Length <> Tb1.Text.Length Then
If Tb2.Text(i) <> Tb1.Text(i) Then
mistakes = mistakes + 1
Else
Tb2.ForeColor = Color.Black
End If
End If
Next i
End Sub
This coce checks for mistakes in tb2 while the user types. Well, if the user types a mistake letter i want it to be red color but only the mistake letter not entire the text. So if for example the user does 3 mistakes i want only the three mistake letters to be red. Is it possible to do it? And how? I think i am missing something after the statement mistakes=mistakes+1 but what exactly? Any help will be much appreciated.
Thanks everyone
in advanced FemPro.