Datagridview and arraylist

  • Thread starter Thread starter Dwight
  • Start date Start date
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
 
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
 
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.
 
Back
Top