BindingSource.Find doesn't work

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.
 
L

Larry Lard

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top