mardi 5 mai 2015

How do I use a rowfilter with a list?

So I have a checkboxlist that I have loaded with values from a datatable, which I then bind to a dataview. I'm trying to filter the dataview based on whatever the user checks in the checkboxlist. Since they can select more than one value, how do I write the rowfilter to use this list which has multiple selected values? If there is a better method then using a list I am open to suggestions, thanks in advance :)

dim GenreList as string = "("   
for item as integer = 0 to CheckListBox.count-1
 GenreList += "'" & CheckListBox.checkedItems(Item) & "',"
next 
 GenreList = GenreList.substring(0,GenreList.Length-1) + ")"
Myview.RowFilter = "Genre = "

Aucun commentaire:

Enregistrer un commentaire