473,418 Members | 2,293 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,418 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 23 '05 #1
4 1900
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 23 '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 23 '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 23 '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 23 '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...
0
by: hazz | last post by:
i have an array (or collection if necessary) of Customers with CustomerID and several properties. For each of these Customers I will have a one to many relationship with Customer products....
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...

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.