By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,575 Members | 1,974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,575 IT Pros & Developers. It's quick & easy.

sorting inherited BindingList

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.