473,654 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.TableStyle s.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.Cl ear" 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 1166
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.TableStyle s.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.Cl ear" 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.mapp ingname 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.TableStyle s.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.Cl ear" 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.mapp ingname 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.EntryPoi nts"; I
tried that name, and I'd tried "EntryPoint s", 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
1312
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 implement such a function with the winform datagrid???\ thank you
1
1507
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 stringValue. The classes that inherit from it use those two properties, plus several properties of their own of types double and vector. I need to display this StatisticsContainer class on a datagrid, but I'm having problems because each of the...
1
1491
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) in a data grid, while I wish to display the products supplied by the vendor (which appears as a collection of product objects in the vendor object property) in another grid. I wish to know how can I accomplish such task. I used data...
1
2316
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 relationship with the customerType table. I would like the WinForm DataGrid to display a column with "Customer Type" where users can select the type of customer from a drop down list.
0
8294
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7309
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.