RobEmDee Posted March 25, 2003 Posted March 25, 2003 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. Quote
Moderators Robby Posted March 25, 2003 Moderators Posted March 25, 2003 I don't 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. '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 Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.