NewsBot
1
Hello,
I have a collection called "SupplierCollection" this is a generic binding*list of T. Where T is any class that derrives from SupplierBase. So I have 4 classes that derrive from SupplierBase and i've created 4 instances of SupplierCollection each with 10 items in. So:
Dim oTransferSupplierCollection as new SupplierCollection(TransferSupplier)
Dim oAccommodationSupplierCollection as new SupplierCollection(AccommodationSupplier)
Dim oFlightSupplierCollection as new SupplierCollection(FlightSupplier)
Dim oCarSupplierCollection as new SupplierCollection(CarSupplier)
I change the binding source (bsSuppliers)*to any of these data sources,*My SupplierCollection has a method SaveCollection(). I want to call the SaveCollection method from the binding source. I'm trying to use this code to do it:
Dim oObj AsObject = bsSuppliers.List
Dim oType As Type = oObj.GetTypeDim oMethodInfo As System.Reflection.MethodInfo = oType.GetMethod("SaveCollection")
oMethodInfo.Invoke(oMethodInfo, Nothing)
Everytime*I run it I get the error: "Object does not match target type.". This error occurs when I call "oMethodInfo.Invoke(oMethodInfo, Nothing)".
I'm sure there is a more pleasant way to this but i've been at this for an hour now and not getting anywhere. Any ideas?
More...
View All Our Microsoft Related Feeds
I have a collection called "SupplierCollection" this is a generic binding*list of T. Where T is any class that derrives from SupplierBase. So I have 4 classes that derrive from SupplierBase and i've created 4 instances of SupplierCollection each with 10 items in. So:
Dim oTransferSupplierCollection as new SupplierCollection(TransferSupplier)
Dim oAccommodationSupplierCollection as new SupplierCollection(AccommodationSupplier)
Dim oFlightSupplierCollection as new SupplierCollection(FlightSupplier)
Dim oCarSupplierCollection as new SupplierCollection(CarSupplier)
I change the binding source (bsSuppliers)*to any of these data sources,*My SupplierCollection has a method SaveCollection(). I want to call the SaveCollection method from the binding source. I'm trying to use this code to do it:
Dim oObj AsObject = bsSuppliers.List
Dim oType As Type = oObj.GetTypeDim oMethodInfo As System.Reflection.MethodInfo = oType.GetMethod("SaveCollection")
oMethodInfo.Invoke(oMethodInfo, Nothing)
Everytime*I run it I get the error: "Object does not match target type.". This error occurs when I call "oMethodInfo.Invoke(oMethodInfo, Nothing)".
I'm sure there is a more pleasant way to this but i've been at this for an hour now and not getting anywhere. Any ideas?
More...
View All Our Microsoft Related Feeds