Create English Typing in VB6

Tips: Create one form and create Button Array for each letter as on keyboard layout and create one RichTextBox for the words to type.
 

Private strWord As String
Private curInd As Integer

Private Sub HighLightKey(ByVal parLetter As String, ByVal par_color As Long)
    Dim i As Integer
    If (Asc(parLetter) >= 65 And Asc(parLetter) <= 65 + 25) Or _
        (Asc(parLetter) > 97 And Asc(parLetter) < 97 + 25) Then
        For i = 0 To 25
            If Asc(parLetter) = 65 + i Or Asc(parLetter) = 97 + i Then
                cmdLetter(i).BackColor = par_color
            End If
        Next
    ElseIf Asc(parLetter) = 13 Then
        cmdLetter(27).BackColor = par_color
    ElseIf Asc(parLetter) = 32 Then
        cmdLetter(26).BackColor = par_color
    End If
End Sub

Private Sub ChangeHighLightKey()
    Dim strPreviousLetter As String
    Dim strLetter As String
    '
    If curInd > 0 Then
        strPreviousLetter = Mid(strWord, curInd, 1)
        HighLightKey strPreviousLetter, &H8000000F
    End If
    '
    If curInd < Len(strWord) Then
        strLetter = Mid(strWord, curInd + 1, 1)
        HighLightKey strLetter, &HFF00&
    End If
End Sub
.................................................................................

Full source code: Download Here

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: