Complex DataView.Filter Scenario

RobEmDee

Well-known member
Joined
Mar 25, 2003
Messages
130
Location
Richmond, VA
I need to enable my users to filter data in a Windows Forms DataGrid on the fly based upon selections in a multiselect ListBox. The ListBox selections filter on one column, however, I am having trouble envisioning an efficient way to filter the DataView based upon multiple selections whenever the user interacts with the ListBox. Thank you ahead of time for any suggestions.
 
I dont have .NET handy so bare with me....
My suggestion is to test with a single item, once that works you will need to builsd a string that contains all the selected items.
Following is for one item only.
Code:
dt (DataTable) is a member of the Class
dv = New DataView(dt)
Dim sWhere As String = "yourColumnName Like " & listbox1.selecteditem & "% "
dv.RowFilter = sWhere
Datagrid1.DataSource = dv
 
Back
Top