Rowfilter options

jccorner

Centurion
Joined
Jan 31, 2004
Messages
144
Here's the scenario. I set a datagrid to contain five columns. One of the columns contains addresses. The datagrid's datasource is based on a dataview. What I am asking is there a way to filter the dataview to only show the records that contain a specific string. For instance:

I have a list of addresses in the dataview:
101 Main Ave.
99 Route 8
78 Jackson Ave.
353 Main Ave.

If I just want the records containing the word Main how can I filter for it?? Should I be trying to using InStr, the downside is that I would have to loop through the entire dataset. Appreciate the assist.
 
I apologize for my ignorance. I found an article letting me know that I can use LIKE and Wildcards. For anyone else, here's the syntax:

Code:
dv.rowfilter = "Address LIKE '%" & txtAddr.text & "' or Address LIKE '" & txtAddr.text & "%' or Address = '" & txtAddr.text & "'"

This way means that if I'm looking for "main" I don't get the records containing "domain" or others I don't want.
 
Back
Top