473,396 Members | 2,076 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,396 software developers and data experts.

sorting inherited BindingList

guy
VB2005
a generic collection that inherits from BindingList, with the code to
support sorting added

(ApplySortCore, SpportsSortingCore etc.)

however when this collection is populated and bound to a DataGridView
ApplySortCore is not called when a grid header is clicked.

how do i ensure this happens?

zzzzz
Feb 8 '06 #1
3 4843
Hi,

"guy" <gu*@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
VB2005
a generic collection that inherits from BindingList, with the code to
support sorting added

(ApplySortCore, SpportsSortingCore etc.)

however when this collection is populated and bound to a DataGridView
ApplySortCore is not called when a grid header is clicked.
A basic setup shows that ApplySortCore is called when SupportsSortingCore
returns True and you click on a column header.

So, not sure why it doesn't work for you, how did you setup the binding ?
Creating a Data Source for your Custom List isn't enough, you still need to
assign the actually list at form load:

Suppose CustomerList inherits from BindingList(Of Customer), a Data Source
was created and dragged on the Form, then you need to add the following
code:

Private _CustomerList As New CustomerList()
Private Sub Form_Load()
CustomerListBindingSource.DataSource = _CustomerList
End Sub

HTH,
Greetings


how do i ensure this happens?

zzzzz

Feb 8 '06 #2
guy
thanks Bert,
the binding works, the gris correctly displays the data however clicking the
column header has no effect

the code is simply

collection.load ' this works
grid.DataSource = collection 'this works
but the column header click never goes anywhere
"Bart Mermuys" wrote:
Hi,

"guy" <gu*@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
VB2005
a generic collection that inherits from BindingList, with the code to
support sorting added

(ApplySortCore, SpportsSortingCore etc.)

however when this collection is populated and bound to a DataGridView
ApplySortCore is not called when a grid header is clicked.


A basic setup shows that ApplySortCore is called when SupportsSortingCore
returns True and you click on a column header.

So, not sure why it doesn't work for you, how did you setup the binding ?
Creating a Data Source for your Custom List isn't enough, you still need to
assign the actually list at form load:

Suppose CustomerList inherits from BindingList(Of Customer), a Data Source
was created and dragged on the Form, then you need to add the following
code:

Private _CustomerList As New CustomerList()
Private Sub Form_Load()
CustomerListBindingSource.DataSource = _CustomerList
End Sub

HTH,
Greetings


how do i ensure this happens?

zzzzz


Feb 10 '06 #3
guy
Bert,

it was a typo

SupportSortingCore() instead of
SupportsSortingCore()

grrrrrrrrrrrrrrrrrrrrrrrrr

"Bart Mermuys" wrote:
Hi,

"guy" <gu*@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
VB2005
a generic collection that inherits from BindingList, with the code to
support sorting added

(ApplySortCore, SpportsSortingCore etc.)

however when this collection is populated and bound to a DataGridView
ApplySortCore is not called when a grid header is clicked.


A basic setup shows that ApplySortCore is called when SupportsSortingCore
returns True and you click on a column header.

So, not sure why it doesn't work for you, how did you setup the binding ?
Creating a Data Source for your Custom List isn't enough, you still need to
assign the actually list at form load:

Suppose CustomerList inherits from BindingList(Of Customer), a Data Source
was created and dragged on the Form, then you need to add the following
code:

Private _CustomerList As New CustomerList()
Private Sub Form_Load()
CustomerListBindingSource.DataSource = _CustomerList
End Sub

HTH,
Greetings


how do i ensure this happens?

zzzzz


Feb 10 '06 #4

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

Similar topics

4
by: hazz | last post by:
The data access layer below returns, well, a mess as you can see on the last line of this posting. What is the best way to return customer objects via a datareader from the data layer into my view...
1
by: Dave Booker | last post by:
Is there a reason why the BindingList constructor doesn't create a new BindingList? Create a form with four ListBoxes and the following will result in them all containing the exact same thing. ...
6
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
1
by: Pieter | last post by:
Hi, I have a custom List that inherits from BindingList. It has some methods overloaded, like the Add/Insert/etc to add and remove some eventhandlers when adding or removing an item T of the...
0
by: Chris Dunaway | last post by:
I posted this to the xml group but got no responses, so I thought I'd try here. I have the following small class which inherits from the generic List class: public class FoodItemList :...
5
by: Mike Surcouf | last post by:
Hi All I have a stored procedure wrapper that returns Collection<T>. The wrapper is generated by codesmith so I don't really want to start altering it. I need to use this collection in a...
3
by: Jesper, Denmark | last post by:
Hi, I've written a C++ program years ago, it's still in use in the company where I work, now its time to port it to .net, preferable managed code. However, I'm a little concerned about a sorting...
3
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be...
6
by: jwilson128 | last post by:
I am trying to decide whether to use a system.ComponentModel.BindingList(of T) or a Sytem.Collections.Generic.List(of T) for a custom collection. In testing a simple, read-only data binding to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
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...
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,...

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.