by Brandon (46 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 16th August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Count the number of occurences of a character in a text box control.
'put a text box and a command button on your form.
'count the number of v's in textbox
Dim i As Integer
Dim x As Integer
Dim count As Integer
Dim char_length As Integer
Dim char As String
x = Len(Text1)
For i = 1 To Len(Text1)
char = Mid(Text1, x, 1)
If char = "v" Then
count = count + 1
End If
x = x - 1
Next
MsgBox "There are a total of " & count & " v's", vbInformation
End Sub
No comments have been posted about Count the number of occurences of a character in a text box control.. Why not be the first to post a comment about Count the number of occurences of a character in a text box control..