Hi all...
I got problem here..
I want to search how much a certain characters in words in text box.
Please help me to solve this...

there are two textbox, first textbox for words and other for current character.

Any help will appreciated greatly.

try this following code :
First Textboxt to input words = textbox2
Second to input certain char = textbox1
Button to execute and label to show result.

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim jmlText, jmlChar, i As Integer
        jmlChar = 0 
        jmlText = Len(TextBox2.Text) 
        For i = 0 To jmlText 
            TextBox2.Focus()
            TextBox2.SelectionStart = i
            TextBox2.SelectionLength = 1
            If TextBox2.SelectedText = TextBox1.Text Then  
                jmlChar = jmlChar + 1 '
            End If
        Next
        Label1.Text = "You have " & jmlChar & " Character " & TextBox1.Text
End Sub
commented: wow.... +1
commented: really a nice code. +1

Thank you for reply jx_man.
This code works like a charm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.