473,395 Members | 1,631 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

DataGridView & Dynamic Properties

Rob
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;
vDataSource.Add(vEntry)

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

vDate.Name = "Time";
vDate.DataPropertyName = "DateAndTime";
dataGridView.Columns.Add(vDate);

Regards,
Rob
Jul 21 '05 #1
1 2139
Rob,
There are for beta testing special newsgroups,
Whidbey groups:
http://communities.microsoft.c*om/ne...p?icp=*whidbey
Infos on how to view these groups with an NNTP news client:
http://communities.microsoft.c*om/ne...US/w*elcomePag...
I hope you find your answer there,
Cor

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rob | last post by:
Dear All, I am having a few issues with DataGridViews. Here is what I have. In a windows form I have added a DataGridView. My data is stored in an array of instances of a class with several...
1
by: Rob | last post by:
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...
10
by: Crazy Cat | last post by:
Hi, I am dynamically creating datagridviews for my application, then filling them with data from a 30 row datatable, and everything seems to work great with one exception. My horizontal...
3
by: WayDownUnder | last post by:
I have a datagridview that is bound to a cutom collection. The classes contained in the custom collection have the properties that are bound to the class . This works fine ! But if one of the...
0
by: Crazy Cat | last post by:
Hi, I've posted on this before, but was unable to get help. I really would like to use this control, but I can't offer it to my users until I am able to resolve this problem. I am creating...
2
by: Rich | last post by:
Hello, Some database applicatins have a tooltip feature where when you are dragging the scrollbar of the table view a tooltip appears next to the mouse cursor displaying the approximate record...
3
by: DEC | last post by:
I have a VB application that's about 95% done. As usual, it's that last 5% that's got me stymied. The program is a Bill-of-material update program that interfaces with an SAP database. The BOM's...
3
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
How can I get the DataGridView to scroll with the Mouse Wheel movement? There aren't any properties to enable it that I have found.
1
by: mtembene | last post by:
I have a windows form "BaseForm" that contains a DataGridView that is not bound to any datasources and a button. Both of these controls have a modifier of "Protected Internal" and none of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.