I'm new to the world of Linq and trying to figure something out.
I've got a CheckedListbox which has been populated like this:-
Dim Categories = From Category In _DB.CategoriesTable Order By Category.Name
lstCategories.DataSource = Categories
lstCategories.DisplayMember = "Name"
lstCategories.ValueMember = "ID"
After the user checks some items, I want to take the checked items, and perform a new Linq statement like this:-
Dim MatchedProducts = From Product In _DB.Products _
Where Product.CategoryID = lstCategories.CheckedItems.ID
However, Product.CategoryID is an integer, and lstCategories.CheckedItems
can contain multiple items.
I believe I have to convert lstCategories.CheckedItems
into a collection to be used in the Linq statement, but I have no idea how to go about it.
Can anyone help?