PC Review


Reply
Thread Tools Rate Thread

Displaying collection in a winform datagrid

 
 
Michael Kellogg
Guest
Posts: n/a
 
      11th Aug 2005
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
 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      11th Aug 2005
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
 
Reply With Quote
 
Michael Kellogg
Guest
Posts: n/a
 
      11th Aug 2005
Chris <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Øyvind Isaksen Microsoft ASP .NET 1 18th May 2007 10:24 AM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Øyvind Isaksen Microsoft Dot NET 1 18th May 2007 10:24 AM
Displaying a Collection of Objects in a DataGrid =?Utf-8?B?R3V5IFRob3JudG9u?= Microsoft Dot NET Compact Framework 5 14th Apr 2006 07:43 PM
Re: Pb displaying a Winform under W2000 Chris Dunaway Microsoft Dot NET 0 8th Mar 2005 02:27 PM
Displaying XML and HTML on a .NET Winform Shawn Hogan Microsoft VB .NET 6 19th Jan 2004 10:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:20 AM.