PC Review


Reply
Thread Tools Rate Thread

Collection(Of T) sortable in DataGridView

 
 
Pieter
Guest
Posts: n/a
 
      15th Nov 2005
Hi,

I made a Collection-class that inherits from
System.Collections.ObjectModel.Collection(Of T), but when I use this
collection as a DataSource of a DataGrid or a DataGridView, it isn't sorted
when the user clicks on the column-headers.

Which Interface do I have to implement for this? And how do I do this? any
sample codes? Or should I use another Collection-class to inherit from?

Thanks a lot in advance,

Pieter


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      15th Nov 2005
Hi,

http://msdn2.microsoft.com/en-us/library/ms171608.aspx

Ken
----------------
"Pieter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I made a Collection-class that inherits from
> System.Collections.ObjectModel.Collection(Of T), but when I use this
> collection as a DataSource of a DataGrid or a DataGridView, it isn't
> sorted when the user clicks on the column-headers.
>
> Which Interface do I have to implement for this? And how do I do this? any
> sample codes? Or should I use another Collection-class to inherit from?
>
> Thanks a lot in advance,
>
> Pieter
>



 
Reply With Quote
 
Bart Mermuys
Guest
Posts: n/a
 
      15th Nov 2005
Hi,

"Pieter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I made a Collection-class that inherits from
> System.Collections.ObjectModel.Collection(Of T), but when I use this
> collection as a DataSource of a DataGrid or a DataGridView, it isn't
> sorted when the user clicks on the column-headers.
>
> Which Interface do I have to implement for this? And how do I do this? any
> sample codes? Or should I use another Collection-class to inherit from?


Have a look at generic BindingList<T>.

HTH,
Greetings

>
> Thanks a lot in advance,
>
> Pieter
>



 
Reply With Quote
 
Pieter
Guest
Posts: n/a
 
      16th Nov 2005
Thanks, it seems I must be able to find what I am looking for there.
I made a Custom Collection Class that inherited from BindingList(Of T), but
it still doesn't sort when clicking on the column-headers...

"Bart Mermuys" <(E-Mail Removed)> wrote in message
news:eIS%(E-Mail Removed)...
> Hi,
>
> "Pieter" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>> I made a Collection-class that inherits from
>> System.Collections.ObjectModel.Collection(Of T), but when I use this
>> collection as a DataSource of a DataGrid or a DataGridView, it isn't
>> sorted when the user clicks on the column-headers.
>>
>> Which Interface do I have to implement for this? And how do I do this?
>> any sample codes? Or should I use another Collection-class to inherit
>> from?

>
> Have a look at generic BindingList<T>.
>
> HTH,
> Greetings
>
>>
>> Thanks a lot in advance,
>>
>> Pieter
>>

>
>



 
Reply With Quote
 
Pieter
Guest
Posts: n/a
 
      16th Nov 2005
Ok, I found what I was looking for:
http://weblogs.asp.net/paulballard/a...21/420099.aspx

:-)

"Pieter" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thanks, it seems I must be able to find what I am looking for there.
> I made a Custom Collection Class that inherited from BindingList(Of T),
> but it still doesn't sort when clicking on the column-headers...
>
> "Bart Mermuys" <(E-Mail Removed)> wrote in message
> news:eIS%(E-Mail Removed)...
>> Hi,
>>
>> "Pieter" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi,
>>>
>>> I made a Collection-class that inherits from
>>> System.Collections.ObjectModel.Collection(Of T), but when I use this
>>> collection as a DataSource of a DataGrid or a DataGridView, it isn't
>>> sorted when the user clicks on the column-headers.
>>>
>>> Which Interface do I have to implement for this? And how do I do this?
>>> any sample codes? Or should I use another Collection-class to inherit
>>> from?

>>
>> Have a look at generic BindingList<T>.
>>
>> HTH,
>> Greetings
>>
>>>
>>> Thanks a lot in advance,
>>>
>>> Pieter
>>>

>>
>>

>
>



 
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
DataGridView - Custom Collection - Remove New Row from Collection =?Utf-8?B?V2ViYmVydA==?= Microsoft Dot NET 0 8th Sep 2006 12:09 PM
Sortable, Bindable Object Collection? =?Utf-8?B?RHlsYW5N?= Microsoft Dot NET Framework 7 27th Feb 2006 03:10 PM
Sortable collection _DS Microsoft C# .NET 10 5th Feb 2006 12:11 AM
Collection(Of T) sortable in DataGridView Pieter Microsoft Dot NET 4 16th Nov 2005 09:34 AM
Collection(Of T) sortable in DataGridView Pieter Microsoft VB .NET 4 16th Nov 2005 09:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:51 PM.