Hi Greg

I should have mentioned that I am playing with the BindingNavigator control
to implement a data entry screen, and a grid to implement a browse screen.

I want to click the grid and have the Navigator move to the record I
selected in the grid.

I thought BindingNavigator.DataSource.Find would be the way to do it, is
there a better way?

Kirsten

 

  _____  

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Greg Keogh
Sent: Thursday, 14 July 2011 10:35 AM
To: 'ozDotNet'
Subject: RE: BindingSource.Find with Entity Framework -
NotSupportedException

 

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



__________ Information from ESET NOD32 Antivirus, version of virus signature
database 6292 (20110713) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Reply via email to