0

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...

2
Contributors
3
Replies
6
Views
8 Years
Discussion Span
Last Post by Sawamura
Featured Replies
  • 2

    try this following code : First Textboxt to input words = textbox2 Second to input certain char = textbox1 Button to execute and label to show result. [code=vb.net]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 = … Read More

0

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

Any help will appreciated greatly.

2

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
Votes + Comments
really a nice code.
wow....
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.