Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / FpSpread Class / Sorted Event
Example


In This Topic
    Sorted Event
    In This Topic
    Occurs when spread is sorted.
    Syntax
    'Declaration
     
    Public Event Sorted As SortedEventHandler
    'Usage
     
    Dim instance As FpSpread
    Dim handler As SortedEventHandler
     
    AddHandler instance.Sorted, handler
    public event SortedEventHandler Sorted
    Event Data

    The event handler receives an argument of type SortedEventArgs containing data related to this event. The following SortedEventArgs properties provide information specific to this event.

    PropertyDescription
    Gets whether to sort by rows (or columns).  
    Gets the index of the starting column of the block of cells to sort.  
    Gets the number of columns in the block of cells to sort.  
    Gets the index of the starting row of the block of cells to sort.  
    Gets the number of rows in the block of cells to sort.  
    Gets the SheetView object.  
    Gets the SortArgs object that contains sort criteria and information about how to perform the sort.  
    Gets the SortingMode setting.  
    Example
    This example uses the Sorted event.
    fpSpread1.ActiveSheet.Columns[1].AllowAutoSort = true;
    fpSpread1.ActiveSheet.Columns[1].AllowAutoFilter = true;
    fpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.EnhancedContextMenu;
    fpSpread1.ActiveSheet.AutoSortEnhancedContextMenu = true;
    fpSpread1.ActiveSheet.AutoSortEnhancedMode = FarPoint.Win.Spread.SortingMode.RangeSorting;
    
    private void fpSpread1_Sorted(object sender, FarPoint.Win.Spread.SortedEventArgs e)
            {
                listBox1.Items.Add(e.Column);
            }
    
            private void fpSpread1_Sorting(object sender, FarPoint.Win.Spread.SortingEventArgs e)
            {
                listBox1.Items.Add(e.ByRows);
            }
    FpSpread1.ActiveSheet.Columns(1).AllowAutoSort = True
    FpSpread1.ActiveSheet.Columns(1).AllowAutoFilter = True
    FpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.EnhancedContextMenu
    FpSpread1.ActiveSheet.AutoSortEnhancedContextMenu = True
    FpSpread1.ActiveSheet.AutoSortEnhancedMode = FarPoint.Win.Spread.SortingMode.RangeSorting
    
    Private Sub FpSpread1_Sorted(sender As Object, e As FarPoint.Win.Spread.SortedEventArgs) Handles FpSpread1.Sorted
            ListBox1.Items.Add(e.Column)
        End Sub
    
        Private Sub FpSpread1_Sorting(sender As Object, e As FarPoint.Win.Spread.SortingEventArgs) Handles FpSpread1.Sorting
            ListBox1.Items.Add(e.ByRows)
        End Sub
    See Also