help needed with generics

Hi

I need to declare a variable that will store  (system.collections.objectmodel.) collections of different types
e.g. collections of object a, collections of object b

I am then binding this variable to a datagrid.

so far the only thing i can get to work is to declare my variable as type object. i then bind this to a datagrid and everything seems to work ok. i initially tried to declare the variable as collection(of object) but i got casting errors when i tried to assign a collection of a different type of object to it

before i get too carried away that this 'will do' as a solution, can anyone see any problems i might face later down the line?

thanks
andrea
andiejeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jayadev NairConnect With a Mentor Application DeveloperCommented:
Hi
I believe the best method is to use for your scenario is System.ComponentModel.BindingList(Of YourClass) and Bind it.

Thanks
0
 
newyuppieCommented:
<<but i got casting errors when i tried to assign a collection of a different type of object to it>>
do you mean when you bind the datagrid to a different collection than the one you already binded it to you get errors?

<<before i get too carried away that this 'will do' as a solution>>
could you specify as a solution to what? what is the objective here?
0
All Courses

From novice to tech pro — start learning today.