Using BindingSource
on LINQ to SQL, and having implemented a BindingList
in my project, I have to use a Textbox
to filter rows in a
I found that "Find" method cannot be used directly with BindingList, but fortunately there is an alternative, using IEnumerable. After Implementing a BindingList in the project, I can filter a bound datagridview using the next code:
private void button1_Click(object sender, EventArgs e)
{
var qry = (from p in dc.Products
select p).ToList();
BindingList list = new BindingList(qry);
IEnumerable selection = list.Where(m => m.ProductName.Contains(textBox1.Text) == true);
productBindingSource.DataSource = selection;
}