sorting inherited BindingList

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Hi,

guy said:
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
 
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
 
Bert,

it was a typo

SupportSortingCore() instead of
SupportsSortingCore()

grrrrrrrrrrrrrrrrrrrrrrrrr
 
Back
Top