Write VB program that counts no of characters & no of words entered in textbox.

Write VB program that counts no of characters & no of words entered in textbox.

Private Sub Command1_Click()

Dim str As String

Dim intCharacters As Integer

Dim intWord As Integer

Dim char As String * 1

Dim I As Integer

str = Text1

intCharacters = Len(str)

For I = 1 TointCharacters

DoEvents

char = Mid(str, I, 1)

If char = " " Then

intWord = intWord + 1

End If

Next I

Label4 = intCharacters

Label5 = intWord + 1

End Sub


Comments