|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
sorting inherited BindingListVB2005
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" <g**@discussions.microsoft.com> wrote in message A basic setup shows that ApplySortCore is called when SupportsSortingCore news:E4DA86FE-4C3C-449C-8B3A-277BF38739F6@microsoft.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. 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 Show quoteHide quote > > how do i ensure this happens? > > zzzzz 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 Show quoteHide quote "Bart Mermuys" wrote: > Hi, > > "guy" <g**@discussions.microsoft.com> wrote in message > news:E4DA86FE-4C3C-449C-8B3A-277BF38739F6@microsoft.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 > > > Bert,
it was a typo SupportSortingCore() instead of SupportsSortingCore() grrrrrrrrrrrrrrrrrrrrrrrrr Show quoteHide quote "Bart Mermuys" wrote: > Hi, > > "guy" <g**@discussions.microsoft.com> wrote in message > news:E4DA86FE-4C3C-449C-8B3A-277BF38739F6@microsoft.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 > > >
Are people using data binding now?
Strongly Typed Key Value Collections within a For Next loop Upgrading VB2003 to 2005 how to do Binding with code Accessing embedded resources Problem adding new row in Access Table Setup Project [URGENT] Images and Thumbnail : pb with rendering quality How to embed the excel worksheet into my forms? Adding summary to object browser? |
|||||||||||||||||||||||