Project To IBindingList

Posts   
 
    
Dan1
User
Posts: 41
Joined: 20-Sep-2007
# Posted on: 01-Oct-2007 17:25:44   
    Dim projector As New ORMSupportClasses.DataProjectorToCustomClass(Of Weld.Business.WeldSpec_Spot_WeldNo)(oWeldSpecs_Spot_WeldNo)

This was working until I found out that the grid I am binding the custom class list to will require the class to implement IBindingList. I changed the oWeldSpecs_Spot_WeldNo to be a BindingList instead of a List collection, but I get an error as the DataProjectorToCustomClass method is expecting an IList object.

Value of type 'System.ComponentModel.BindingList(Of Weld.Business.WeldSpec_Spot_WeldNo)' cannot be converted to 'System.Collections.Generic.List(Of Weld.Business.WeldSpec_Spot_WeldNo)'.

Is there anyway to project onto a BindingList<T> instead of the regular List<T>

-Dan

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 02-Oct-2007 12:06:55   

This was working until I found out that the grid I am binding the custom class list to will require the class to implement IBindingList.

I think the IBindingList should be implemented on the collection holding instances of your customClass, not to be implemented in the Custom Class itself.

Value of type 'System.ComponentModel.BindingList(Of Weld.Business.WeldSpec_Spot_WeldNo)' cannot be converted to 'System.Collections.Generic.List(Of Weld.Business.WeldSpec_Spot_WeldNo)'.

Would you please post the corresponding code snippet?

Dan1
User
Posts: 41
Joined: 20-Sep-2007
# Posted on: 02-Oct-2007 14:13:58   

No that's not what I was trying to do. I ended up just using a List instead of bindingList to project onto and then I create a new BindingList object that I pass in the List into the constructor and voila I get a BindingList.

Thanks anyway