BindingSource.Find doesn't work

  • Thread starter Thread starter Murat Ozgur
  • Start date Start date
M

Murat Ozgur

Hello,

I have a problem with BindingSource.Find method. I bind a "list" to a
bindingsource then I use find method to find an object which has name
"Fred" :

List<Employee> empList = new List<Employee>;
.....
bindingSource1.DataSource = empList;
......
bindingSource1.Find("Name", "Fred")

but find method throws a NotSupportedException and its message is "This
operation requires an IBindingList.".

what is wrong ?

Thanks.
 
Murat said:
Hello,

I have a problem with BindingSource.Find method. I bind a "list" to a
bindingsource then I use find method to find an object which has name
"Fred" :

List<Employee> empList = new List<Employee>;
.....
bindingSource1.DataSource = empList;
......
bindingSource1.Find("Name", "Fred")

but find method throws a NotSupportedException and its message is "This
operation requires an IBindingList.".

what is wrong ?

Like it says, it can only Find in IBindingList's. List<T> is a
'lightweight' class designed for performance - for binding to, use
BindingList<T> (which implements IBindingList).
 
Back
Top