473,511 Members | 16,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2147
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
1791
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
357
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
12121
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
8361
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
1765
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
7409
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
2647
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
4899
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
2839
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
7242
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
7355
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,...
1
7081
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...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.