471,336 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

DataGridView & Dynamic Properties

Dear All,

I have a class that exposes a few properties. These properties are used in a
DataGridView. The code for that is shown bellow. The problem is that I also
need to show data/columns/properties in the DataGridView that are not known
at compile time. The total number of these data/columns/properties is also
not known. So the question is how can I dynamically add properties (indexers
don't seem to work) so that DataGridView can show all of them? What other
ideas do you have?

class CDataSource
public DateTime DateAndTime {
get { return m_vDateTime; }

//Data source is a list of CDataSource instances
ArrayList vDataSource = new ArrayList();
CDataSource vEntry = new CDataSource;

dataGridView.AutoGenerateColumns = false;
dataGridView.DataSource = m_avDataSource;
DataGridViewTextBoxColumn vDate = new DataGridViewTextBoxColumn();

vDate.Name = "Time";
vDate.DataPropertyName = "DateAndTime";

Jul 21 '05 #1
1 1938
There are for beta testing special newsgroups,
Whidbey groups:
Infos on how to view these groups with an NNTP news client:
I hope you find your answer there,

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rob | last post: by
1 post views Thread by Rob | last post: by
3 posts views Thread by WayDownUnder | last post: by
3 posts views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.