Filling DataGrid from collection class

Hello again,

is it possible to fill a datagrid based on a collection class?

my collection class is inheriting from the DictionaryBase class.


Who is Participating?

MSDN said: "The data source must be an object that implements the System.Collections.IEnumerable interface"

you can fill a datagrid based on a collection class which inheriting from the DictionaryBase class. Because DictionaryBase is the class implement IEnumerable interface.
brdrokAuthor Commented:
Hey dungla....

thanks for your feedback.  I can't seem to find "The data source must be an object that implements the System.Collections.IEnumerable interface".  Can you please provide a link.  

The closest thing i saw was: "The following data sources are valid: Any component that implements the IList interface"

However, from what I have gathered so far is that the "DictionaryBase" is implementing the following interfaces: ICollection, IEnumerable, and IDictionary. Does that mean, I am out of luck?  Does that mean I will have to declare my class like this:

public class Employees : DictionaryBase, IList

So many questions, and only so many hours in a day :)

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Hi brdrok, the answer to your question is yes.  The DictionaryBase inherits from ICollection, which is a parent of IList.  So you would need to include IList on your class definition and implement the needed functions for IList.
brdrokAuthor Commented:

thank you.  I have posted another question (400 pts) asking how to implement the Add method of the IList interface.  Can't seem to get it to work.  If you would like to take a crack at it, it should be there.  thanks


Here is the link in my MSDN July 2004


The topic: BaseDataList.DataSource Property  [C#]
brdrokAuthor Commented:
thanks for the help.  i suppose creating a dataview is the way to go about this.  still was somehow hoping to implement the IList interface to my DictionaryBase collection class but appearantly I am still too dumb :(

Was trying to ge the best of both worlds.  implement the IList so i can use it as a datasource for a datagrid, but I also like the key, value pair as well....  

anywho......thanks for all your help you two....

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.