This is a visual basic 6.0 source code to count the characters in a specified string. This function can be useful in Text editors or where you want to tell the user that how much characters have been inputted in the text field. You can also define which characters to count and which do not.

'*******************************************************
'*     MYCPLUS Sample Code - https://www.mycplus.com     *
'*                                                     *
'*   This code is made available as a service to our   *
'*      visitors and is provided strictly for the      *
'*               purpose of illustration.              *
'*                                                     *
'* Please direct all inquiries to saqib at mycplus.com *
'*******************************************************

Public Function CountCharacters(ByVal Text As String) As Integer
    Dim counter%, t%
    Const Characters$ = "abcdefghijklmnopqrstuvwxyz"

    For t% = 1 To Len(Text)
        If InStr(Characters, LCase$(Mid$(Text, t%, 1))) <> 0 Then
            counter% = counter% + 1
        End If
    Next t%
    CountCharacters = Counter%
End Function