Reputation: 15
Wondering if I am doing this filter right with the dataview, it keeps throwing me this error
Additional information: Filter expression '80' does not evaluate to a Boolean term.
but here is the code
Dim table = DataSet1.Tables("network")
table.DefaultView.RowFilter = TextBox1.Text
DataGridView1.DataSource = table
Upvotes: 1
Views: 24112
Reputation: 216263
To filter something on a DataVIew you need to specify the column on which the filter should be applied, the operator for the comparison and the value that you want to use for the filtering. It seems that you have given only the value "80".
For example, assuming the column of interest is named "NumberOfPieces" and you have typed 80 in the textbox
Dim table = DataSet1.Tables("network")
table.DefaultView.RowFilter = "NumberOfPieces = " & TextBox1.Text
DataGridView1.DataSource = table
This will filter the view with all the rows that have the value (a numeric value) equals to 80 in the column "NumberOfPieces". You could use other operators like Greater/Lesser Than ( >= <= ) or more complex construct that are well detailed in the MSDN page about the Expression property of the DataColumn object
Upvotes: 2