asked on
VB.net BindingSource Filter string
I am trying to get a search criteria that is found anywhere in a string to return in the filter results.
[exisiting code] Master_ContactsBindingSour
The problem is that I receive no results (and does not error either) for terms that I know are in the table such as "son".
The desired result is to return all records that contain the search term "son" but clearly I have this wrong.
c_company = [table field]
[CompanySearch.text] is the textbox with the search term
Thoughts?
ASKER
Eric,
I 'think' I had that sequence somewhere along the way of experimenting. I corrected the string to read as you indicated (I agree with it) however I still receive no results for something such as 'b'. To sort this out I've included some strings that DO work in other areas of the program for reference. I know the field and string captures correctly. The hangup is when I get to the Instr (issue).
Master_ContactsBindingSource.Filter = "c_company like '" & CompanySearch.Text & "*'"
Master_ContactsBindingSource.Filter = "c_address <>'' And c_company Like '" & CompanySearch.Text & "*'"
I appreciate your help!
Scott
ASKER
I found that the following works perfect. Boy was I climbing the wrong side of the tree!
Master_ContactsBindingSource.Filter = "c_company like '%" & CompanySearch.Text & "%'"
I get any occurrence of a string which was the goal.
Thank you for the poke Eric!
Open in new window