Problems in sorting Date columns

Posted by: fpuserteam on 8 September 2017, 1:20 pm EST

  • Posted 8 September 2017, 1:20 pm EST

    Hi,


    After upgrading from Farpoint Spread 3.0 to Spread 4.0, Date columns are getting sorted properly. The code is pasted below.


    Private Sub grdUpdateTaskSchedule_CellClick(ByVal sender As Object, _
                ByVal e As FarPoint.Win.Spread.CellClickEventArgs) _
                Handles grdUpdateTaskSchedule.CellClick
                Dim intSortColumn As Integer = Integer.MinValue


                'If Grid is not yet validated then do not continue
                If blnLeaveCell = False Then
                    grdUpdateTaskSchedule_Leave(sender, e)
                    Exit Sub
                End If


                If e.ColumnHeader = True Then
                    With grdUpdateTaskSchedule.ActiveSheet
                        'Identify the column to Sort
                        If e.Column = 14 Then
                            intSortColumn = 20
                        Else
                            intSortColumn = e.Column
                        End If


                        'Copied the Code from MPMDataGrid Sheet_CellClick Event
                        Dim sort(1) As FarPoint.Win.Spread.SortInfo
                        sort(0) = New FarPoint.Win.Spread.SortInfo(intSortColumn, _
                            b_SortOrder, System.Collections.Comparer.Default)
                        .SortRange(0, 0, .Rows.Count, .ColumnCount, True, sort)
                    End With


                    'Copied the Code from MPMDataGrid Sheet_CellClick Event
                    If b_SortOrder Then
                        b_SortOrder = False
                    Else
                        b_SortOrder = True
                    End If
                ElseIf (e.Column = 14 OrElse e.Column = 15 OrElse e.Column = 16) AndAlso _
                        grdUpdateTaskSchedule.ActiveSheet.Cells(e.Row, e.Column).Text <> _
                        String.Empty Then
                    Try
                        'Set the Save Dialog Properties
                        sfdTaskSchedule.FileName = _
                            grdUpdateTaskSchedule.ActiveSheet.Cells(e.Row, e.Column).Text
                        sfdTaskSchedule.Filter = "CSV files (*.csv)|*.csv"
                        sfdTaskSchedule.FilterIndex = 2
                        sfdTaskSchedule.RestoreDirectory = True


                        'Show the Dialog
                        If sfdTaskSchedule.ShowDialog() = Windows.Forms.DialogResult.OK Then
                            'Check whether File Exists
                            If grdUpdateTaskSchedule.FileInUse(sfdTaskSchedule.FileName) Then
                                MessageBox.Show(GetDisplayMessage("ErrFileOpen"), _
                                    Me.Text, MessageBoxButtons.OK, MessageDisplayIcon, _
                                    MessageBoxDefaultButton.Button1)
                            Else
                                'Save the File
                                System.IO.File.Copy(strEProFilePath + _
                                    grdUpdateTaskSchedule.ActiveSheet.Cells( _
                                        e.Row, e.Column).Text, sfdTaskSchedule.FileName, True)
                            End If
                        End If


                        'Move the Focus to a control left of the cell
                        grdUpdateTaskSchedule.EditMode = False
                    Catch ex As Exception
                        ExceptionPolicy.HandleException(ex, EXCEPTIONLOGPOLICY)
                        DisplayCustomError(GetDisplayMessage("ExLoadData"), Me.Text, ex)
                    End Try
                End If
            End Sub 


     

  • Replied 8 September 2017, 1:20 pm EST

    You said the sorting is working properly.  Did you mean this code is not working correctly and if so what issue are you seeing?
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels