BindingSource.DataSource = GetCustomers(); 

BindingSource.Sort = "CustomerID";

BindingSource.Find("CustomerID", customerID );

 

NotSupportedException

This operation requires an IBindingList.

 

The generic List class does not implement IBindingList. I'm not sure who is
asking for the IBindingList, but it has to be the Find method. Ah yes, only
DataSet, DataTable and DataView implement it.

 

I think you're misusing the BindingSource. I usually put it "between" the
real data source collection and a control like a grid where it gives me a
bit more flexibility in UI binding. If you want to find certain Customers
that I'd search the actual List, not the binding source.

 

Customer cust = custList.Find(c => c.CustomerID == 666);

or

Customer cust = (from c in custList where c.CustomerID == 666 select
c).SingleOrDefault();

 

Greg

Reply via email to