Adding to collection using BindingSource

Adding to collection using BindingSource

Old forum URL: forums.lhotka.net/forums/t/2721.aspx


MarkBoehlen posted on Tuesday, April 17, 2007

I am using a BindingSource control with my business objects.  The BindingSource appears to call the IBindingList.AddNew method on the list.  This will fail unless the Business Base object has a public constructor.  Is there another way around this? 

Bayu replied on Wednesday, April 18, 2007

Hi,

Assuming that you bind a BusinessListBase derived class to your bindingsource you will have to override AddNewCore in your class. If this method returns an object then the bindingsource will be happy and won't try to instantiate objects through reflection.

Bayu

MarkBoehlen replied on Wednesday, April 18, 2007

That be it.  Thanks.

Copyright (c) Marimer LLC