I am trying to search through my DGV using a Combobox to get the name for the Column and textbox for the search query. I used this code before, and it worked, but now I get an EvaluateException saying
Cannot perform ‘Like’ operation on System.Double and System.String.
Here’s what I’m doing:
Dim dv As DataView = New DataView()
Dim CmSi = cmbSearch.SelectedItem
dv.Table = OutGoingDataSet.outgoingdeliveries
dv.RowFilter = CmSi & " Like '" & txtSearch.Text & "'"
OutgoingDataGridView.DataSource = dv
How do I fix this problem?
Here’s your problem. When you apply your filter you do this check:
This will work for all columns that are containing strings. Doubles will not work since they are not strings. Basically this would be like
which of course is false.
So you have to convert your double to a string before doing a
LIKEcomparison. I cannot tell if it will work or not, but I reckon it will.