By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,378 Members | 1,558 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,378 IT Pros & Developers. It's quick & easy.

bind specific elements of arraylist to datagrid

P: n/a
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


Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


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

Best regards
Vuong,
Tran Xuan

"Harry" <ma*******@hotmail.com> wrote in message
news:#Y**************@TK2MSFTNGP14.phx.gbl...
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

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.