Solved

help needed with generics

Posted on 2006-11-22
2
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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