Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.
  • Moderators
Posted

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

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...