0
Private Sub GridViewLog_StartSorting(ByVal sender As Object, ByVal e As EventArgs) Handles GridViewLog.StartSorting
SetDefaultSort()
End Sub

Private Sub SetDefaultSort()
        Dim col1 As DevExpress.XtraGrid.Columns.GridColumn
        Dim col2 As DevExpress.XtraGrid.Columns.GridColumn
        Dim sortIndex As Integer
        Dim order As DevExpress.Data.ColumnSortOrder
        Try
            col1 = GridViewLog.Columns("Date_Field")
            col2 = GridViewLog.Columns("Time_Field")
            If Not ((GridViewLog.SortedColumns.Contains(col1) OrElse GridViewLog.GroupedColumns.Contains(col1)) AndAlso (GridViewLog.SortedColumns.Contains(col2) OrElse GridViewLog.GroupedColumns.Contains(col2))) Then

                Me.GridViewLog.BeginSort()

                If col1.SortOrder = DevExpress.Data.ColumnSortOrder.None Then
                    order = col2.SortOrder
                Else
                    order = col1.SortOrder
                End If
                If order = DevExpress.Data.ColumnSortOrder.None Then
                    order = DevExpress.Data.ColumnSortOrder.Descending
                End If
                sortIndex = GridViewLog.SortedColumns.Count
                Me.GridViewLog.Columns("Date_Field").SortIndex = sortIndex - 1
                Me.GridViewLog.Columns("Date_Field").SortOrder = order
                Me.GridViewLog.Columns("Time_Field").SortIndex = sortIndex
                Me.GridViewLog.Columns("Time_Field").SortOrder = order
                Me.GridViewLog.EndSort()
            End If
        Catch ex As Exception

        End Try
     End Sub

Changed some times to 10:31 and they didn't re-sort. I then hit Time at the top of the column and it still didn’t change. Please check the attached screenshot

Screenshot

ND's
  • 2,155
  • 6
  • 38
  • 59

1 Answers1

0

I think there are two options:

  1. Set the columns' SortMode property to ColumnSortMode.Value

  2. Use CustomColumnSort event and set the columns' SortMode property to ColumnSortMode.Custom

Marko Juvančič
  • 5,792
  • 1
  • 25
  • 41
  • i have test by setting ColumnSortMode.Value =ColumnSortMode.Value still the coloumn not sorts properly – ND's Jul 26 '16 at 10:00