473,322 Members | 1,417 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,322 software developers and data experts.

Collection(Of T) sortable in DataGridView

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
Nov 22 '05 #1
4 1192
Hi,

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

Ken
----------------
"Pieter" <pi**********@hotmail.com> wrote in message
news:ec*************@TK2MSFTNGP15.phx.gbl...
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

Nov 22 '05 #2
Hi,

"Pieter" <pi**********@hotmail.com> wrote in message
news:ec*************@TK2MSFTNGP15.phx.gbl...
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

Nov 22 '05 #3
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" <bm*************@hotmail.com> wrote in message
news:eI****************@tk2msftngp13.phx.gbl...
Hi,

"Pieter" <pi**********@hotmail.com> wrote in message
news:ec*************@TK2MSFTNGP15.phx.gbl...
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


Nov 22 '05 #4
Ok, I found what I was looking for:
http://weblogs.asp.net/paulballard/a...21/420099.aspx

:-)

"Pieter" <pi**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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" <bm*************@hotmail.com> wrote in message
news:eI****************@tk2msftngp13.phx.gbl...
Hi,

"Pieter" <pi**********@hotmail.com> wrote in message
news:ec*************@TK2MSFTNGP15.phx.gbl...
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



Nov 22 '05 #5

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

Similar topics

5
by: Audrius | last post by:
Hello, what is the best solution to hold the collection of Objects. Lets say I have such class: class Task{ private: CString title; CString description; CString owner;
5
by: Oberon | last post by:
I want to create a collection of records which will be permanently available at the application level in an ASP.NET application. How should I go about that? Lets say that the record structure...
1
by: Howard Weiss | last post by:
I would like to create a collection of managed objects - to be exact, instances of a form which I use to display images. This collection would be similar to the controls collection which is part...
10
by: Chet Cromer | last post by:
I am creating a set of base classes and sub classes to use throughout a program I'm developing. The base class represents a generic "lookup table" from my database that contains lists of things...
4
by: Pieter | last post by:
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...
4
by: zacks | last post by:
A common programming technique I use in VB is making a collection of structures. But if Option Strict is on (which I would prefer), the .Add that adds the structure to the collection is flagged...
14
by: Jeff S. | last post by:
In a Windows Forms application I plan to have a collection of structs - each of which contains a bunch of properties describing a person (e.g., LastName, FirstName, EmployeeID, HomeAddress,...
3
by: djcamo | last post by:
Hi, I have a situation where I have a collection that holds numbers. Mostly they are concurrent eg. 125801-125899 but sometimes they are not eg. 125801-125899, 195301-399. Is there any way to...
4
by: Michael C | last post by:
I wish to show a collection of objects in the DataGridView control. This is working fairly well except in one particular case. If my collection starts empty when I assign it to the grid then when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.