473,394 Members | 2,160 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,394 software developers and data experts.

Displaying collection in a winform datagrid

I have a collection of objects that I am trying to display in a Windows
Forms Datagrid. I have had problems doing this before, so the first time
around I went and did a Grid.TableStyles.Clear before naming my collection
as the DataSource.

In this scenario, the collection's members come up perfect in the datagrid,
but I have no control over the look of it. So I added a TableStyle and a
GridColumnStyle object in the designer, giving the names of my collection's
object's members as the MappingName property for each column. I left the
MappingName of the TableStyle blank. I also got rid of the
"TableStyles.Clear" line.

In short, nothing different happens. Everything loads in as though there
were no tablestyle defined. Can anyone tell me why, and how to make my
tablestyle appear?

--
Michael
Nov 21 '05 #1
2 1152
Michael Kellogg wrote:
I have a collection of objects that I am trying to display in a Windows
Forms Datagrid. I have had problems doing this before, so the first time
around I went and did a Grid.TableStyles.Clear before naming my collection
as the DataSource.

In this scenario, the collection's members come up perfect in the datagrid,
but I have no control over the look of it. So I added a TableStyle and a
GridColumnStyle object in the designer, giving the names of my collection's
object's members as the MappingName property for each column. I left the
MappingName of the TableStyle blank. I also got rid of the
"TableStyles.Clear" line.

In short, nothing different happens. Everything loads in as though there
were no tablestyle defined. Can anyone tell me why, and how to make my
tablestyle appear?


It's because it doesn't which tablestyle to use. You need to name the
tablestyle.mappingname to the name of your collection.

Chris
Nov 21 '05 #2
Chris <no@spam.com> wrote:
Michael Kellogg wrote:
I have a collection of objects that I am trying to display in a
Windows Forms Datagrid. I have had problems doing this before, so
the first time around I went and did a Grid.TableStyles.Clear before
naming my collection as the DataSource.

In this scenario, the collection's members come up perfect in the
datagrid, but I have no control over the look of it. So I added a
TableStyle and a GridColumnStyle object in the designer, giving the
names of my collection's object's members as the MappingName property
for each column. I left the MappingName of the TableStyle blank. I
also got rid of the "TableStyles.Clear" line.

In short, nothing different happens. Everything loads in as though
there were no tablestyle defined. Can anyone tell me why, and how to
make my tablestyle appear?


It's because it doesn't which tablestyle to use. You need to name the
tablestyle.mappingname to the name of your collection.

Thanks for the pointer. I had messed with that earlier but couldn't get
anything to change. The name of my datasource was "m_doc.EntryPoints"; I
tried that name, and I'd tried "EntryPoints", neither of which had any
effect. I just now tried "Collection" and VOILA... Bizarre.

--
Michael
Nov 21 '05 #3

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

Similar topics

0
by: zbcong | last post by:
hello in my winform,there is a datagrid,i want to fire some actions when the selected index is changed,but i fail to find the SelectedIndexChanged event to the winform datagrid,why? how can i...
1
by: Michael Gorbach | last post by:
Iv got a StatisticsContainer object that contains an arraylist of objects of different types, all inherited from class Statistic. The statistics class has 2 string public properties, name and...
1
by: thf | last post by:
Hi, I wish to know how to display a collection of object which is a property in another object in a data grid in VB.Net. For example, I'm displaying a collection of vendor objects (in ArrayList)...
1
by: Jon B | last post by:
Hi All! I would like to make my WinForm DataGrid control so that user could easily edit the items in the **related table**. For instance, I have customers table and it has one-to-many...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...

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.