I'm using the filter method of Binding source in VB.net to filter results in a DataGridView based on the text in a search box. However, the idea of this search, is that it shows a row if any of the cells contain the text. So my filter string ends up looking like this:
filter = "ProductId LIKE '%" & searchterm & "%'" & " OR ScanDate like '%" & searchterm & "%'"
However, when I try to put the filter in the filter property, it complains, saying that it cannot convert the date column to text for the comparison.
Is there a way to tell the filter to cast the datetime cells to string?
What I'm considering doing is having a hidden column in the dataset that contains a casted version of the date, and I'll tell the filter to filter that column.
Here's my assign code:
bindingSource.Filter = filter
dgv.DataSource = bindingSource.DataSource
Best Answer
I got it, and it works