Search on flexgrid vb6

hi friends,
i was adding a search option to my vb6 project form on flexgrid object.. i wrote a set of code which works fine to find fields which is not matching and removing from the flexgrid (ultimately the rest will be the search answer)..but the issue what i am facing right now is i need to find all the partial matching fields, :if a person searching for the name john all the names starts or end with john need to be displayed.. i hope you understood my issue..

the code i written is given below

 Dim target_name As String
  target_name = InputBox("Enter The Keyword you wish to Search", "Search")
  If Len(target_name) = 0 Then Exit Sub
  target_name = LCase$(target_name)

Dim r As Integer
Dim c As Integer
Dim boo As Boolean

  For r = FlexGrid.Rows - 1 To 1 Step -1
    boo = False
         For c = 1 To FlexGrid.Cols - 1
         If LCase(FlexGrid.TextMatrix(r, c)) = target_name Then
         boo = True
         Exit For
       End If
       Next c

    If boo = False Then FlexGrid.RemoveItem (r)
  Next r
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If LCase(FlexGrid.TextMatrix(r, c)) = target_name Then

If InStr(1, FlexGrid.TextMatrix(r, c), target_name, vbTextCompare) Then

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IntelopsAuthor Commented:
the above mentioned issue was resolved through the method specified by mr.danaseaman.. but now i have an issue with the same code

if my fixed rows on the flexgrid is enabled its giving an error that as "Cannot remove last non-fixed row" while the search didnt return any answer.. can anybody help me on this..???
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.