Datagridview and arraylist

D

Dwight

You can attach an arraylist to a datgridview by dgv.datasource =
arraylist.

If the arraylist elements are a class, is there a way to databind this
class to particular columns in grid?

Thanks
 
C

Cor Ligthert [MVP]

Dwight,

How does the program know that all objects in the arraylist are of the same
type.

I never tried it, but I would certainly use a list(of Myclass) in this case.
That is strongly typed so it can only from one type.

Cor
 
D

Dwight

Cor said:
Dwight,

How does the program know that all objects in the arraylist are of the same
type.

I never tried it, but I would certainly use a list(of Myclass) in this case.
That is strongly typed so it can only from one type.

Cor

I do use a list(of myclass), but I can't find or understand any
documentation that allows me to bind to columns.

When you do dgv.datasource=arraylist, it just adds new columns with the
data. So basically your class properties are the column names. I want a
little more control than that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top