Saturday, February 12, 2011

Searching a letter within a text

Hi guys! in this program the user will type any text and the user will input on the next textbox the letter that is going to be searched. After that the user will click the button name "Search" then the output will show. Below is the source code of this program. Hope this will help you. Enjoy and Happy coding! :)


Private Sub Command1_Click()
Dim x, y As Integer
    For x = 1 To Len(Text1.Text)
        If Mid(Text1.Text, x, 1) = Text2.Text Then
            y = y + 1
        End If
    Next
Label1.Caption = y
Label2.Caption = Text2.Text & " 's"
End Sub

No comments:

Post a Comment