I am trying to use LINQ to create custom filters. My goal is to allow for the where clause of the LINQ query to change depending on what the user selects.
My main goal is to filter by selected names in a multi select listbox.
I am trying to do something along these lines
USER SELECTED ITEMS
For Each itm In ListBox1.SelectedItems
strg += itm.ToString & " Or "
Dim qry = (From invoice In tblCashIn.GetData
Where invoice.Customer_Name = strg
What I am having trouble with is embedding the Or operator (or any operator, AND, XOR, AndAlso, etc...). Since I am building the Or in as a string, the Where statement in the LINQ query does not pickup that it should be multiple parameters to search for.
Any help would be great. I am not 100% sure this is possible with LINQ, if it is not, it would be great if you might have some comparable way of accomplishing my goal (Excluding basic SQL queries, I am trying to keep everything strongly typed if possible).