Solved

help needed with generics

Posted on 2006-11-22
2
166 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:andieje
2 Comments
 
LVL 13

Expert Comment

by:newyuppie
ID: 17995103
<<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
 
LVL 6

Accepted Solution

by:
Jayadev Nair earned 500 total points
ID: 17996947
Hi
I believe the best method is to use for your scenario is System.ComponentModel.BindingList(Of YourClass) and Bind it.

Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now