I'm manage how to find word in textbox.
In textbox : "How i can be a good programer? How i achieve that?"
If i want to search "How" then it should return 2 How words in text.

Please Help.
Thank You.

Recommended Answers

All 6 Replies

How far you doing this?
Post the code that you've been work.

This what i have so far :

Dim str As String
Dim i, temp, Count As Integer
Count = 0

While temp > 0
    temp = InStr(1, Text1.Text, "How")
    Count = Count + 1
MsgBox Count

But the result is wrong.

See if this helps :

Dim i, Count As Integer

Count = 0

i = InStr(i + 1, Text1.Text, "How")
If i = 0 Then
    MsgBox 0
    Exit Sub
End If

Do While i > 0
    i = InStr(i + 1, Text1.Text, "How")
    Count = Count + 1

MsgBox Count
commented: Thanks +2
commented: Nice code +2

Thanks jx..it worked fine.

You're Welcome.
Don't Forget to mark this thread as solved.
Happy Coding ;)

Thankyou Dear. You helped me a lot.

Be a part of the DaniWeb community

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