How to fix incomplete sorting in datagridview?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peter gregory
    New Member
    • Jan 2011
    • 1

    #1

    How to fix incomplete sorting in datagridview?

    Getting incomplete sorting in datagridview whether clicking on the grid column header or using a sort method on an unbound grid sorts imcompletely. On some cols it appears to sort all rows except the last, on others it changes row order but the selected column is all over the place! I would appreciate any help!

    Unfortunately the code is 28 forms and very long. Here is the sub that is called when I click on the column header

    Code:
     Public Sub SortGrid(ByVal sender As System.Object, ByVal rowindex As Integer, ByVal colindex As Integer)
            Dim col As DataGridViewColumn
            col = sender.Columns.Item(colindex)
            col.SortMode = DataGridViewColumnSortMode.Programmatic
            If rowindex = -1 Then sender.Sort(col, System.ComponentModel.ListSortDirection.Ascending)
        End Sub
    I can send you 3 views that illustrate the problem but dont seem able to include them in this post.
    Last edited by Niheel; Jan 31 '11, 06:12 PM. Reason: merged question with code
Working...