bind specific elements of arraylist to datagrid

  • Thread starter Thread starter Harry
  • Start date Start date
H

Harry

I want to bind three elements of an seven element arraylist to a data grid.
I cannot find an example of complex binding specific fields of an array list
to a datagrid.

Any examples would be appreciated.

m_Stat = new Stat(str1,str2,str3,str4,str5);

m_arrlstStats.Add(m_Stat);



grdStats.DataSource = m_arrlstStats; // only want to show str1, str2 and
str3 here

grdStats.Refresh();

I could overload the Stat object and put only three elements in another
arraylist, but that does not seem to be best practices. I beleive it would
be best to modify the mapping of the datagrid, but do not know how. All of
the standard examples assume you are useing a database and not an array. How
do you table map an array?



Many thanks

Harry
 
Harry,
You can create a datatable that meet your need and put it to datagrid.

Best regards
Vuong,
Tran Xuan
 
Back
Top