Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / SortInfo Class / Comparer Property
Example


In This Topic
    Comparer Property (SortInfo)
    In This Topic
    Gets or sets the IComparer object for the method of comparison.
    Syntax
    'Declaration
     
    Public Overridable Property Comparer As IComparer
    'Usage
     
    Dim instance As SortInfo
    Dim value As IComparer
     
    instance.Comparer = value
     
    value = instance.Comparer
    public virtual IComparer Comparer {get; set;}

    Property Value

    IComparer object to customize the sort order of a collection
    Remarks

    This property gets or sets the IComparer object to determine the method of comparison. If the value is null, the System.Collections.Comparer.Default is used.

    Example
    FarPoint.Win.Spread.SortInfo[] sort = new FarPoint.Win.Spread.SortInfo[1];
    sort[0] = new FarPoint.Win.Spread.SortInfo(0, true, System.Collections.Comparer.Default);
    bool b;
    int i;
    System.Collections.Comparer;
    sort[0] = New FarPoint.Win.Spread.SortInfo(0, True, System.Collections.Comparer.Default)
    b = sort[0].Ascending
    c = sort[0].Comparer
    i = sort[0].Index
    fpSpread1.ActiveSheet.SetValue(0, 0, "S");
    fpSpread1.ActiveSheet.SetValue(0, 1, "E");
    fpSpread1.ActiveSheet.SetValue(0, 2, "A");
    fpSpread1.ActiveSheet.SetValue(0, 3, "K");
    fpSpread1.ActiveSheet.SetValue(1, 0, "W");
    fpSpread1.ActiveSheet.SetValue(1, 1, "G");
    fpSpread1.ActiveSheet.SetValue(1, 2, "P");
    fpSpread1.ActiveSheet.SetValue(1, 3, "V");
    fpSpread1.ActiveSheet.SetValue(2, 0, "O");
    fpSpread1.ActiveSheet.SetValue(2, 1, "L");
    fpSpread1.ActiveSheet.SetValue(2, 2, "Q");
    fpSpread1.ActiveSheet.SetValue(2, 3, "H");
    fpSpread1.ActiveSheet.SortColumns(0, 2, sort);
    label1.Text = "Is the sort ascending is " + b.ToString() + " and the type of comparer is " + Convert.ToString(c) + " and the
    index is " + i.ToString();
    
    Dim sort(1) As FarPoint.Win.Spread.SortInfo
    Dim b As Boolean
    Dim i As Integer
    Dim c As System.Collections.Comparer
    sort(0) = New FarPoint.Win.Spread.SortInfo(0, True, System.Collections.Comparer.Default)
    b = sort(0).Ascending
    c = sort(0).Comparer
    i = sort(0).Index
    FpSpread1.ActiveSheet.SetValue(0, 0, "S")
    FpSpread1.ActiveSheet.SetValue(0, 1, "E")
    FpSpread1.ActiveSheet.SetValue(0, 2, "A")
    FpSpread1.ActiveSheet.SetValue(0, 3, "K")
    FpSpread1.ActiveSheet.SetValue(1, 0, "W")
    FpSpread1.ActiveSheet.SetValue(1, 1, "G")
    FpSpread1.ActiveSheet.SetValue(1, 2, "P")
    FpSpread1.ActiveSheet.SetValue(1, 3, "V")
    FpSpread1.ActiveSheet.SetValue(2, 0, "O")
    FpSpread1.ActiveSheet.SetValue(2, 1, "L")
    FpSpread1.ActiveSheet.SetValue(2, 2, "Q")
    FpSpread1.ActiveSheet.SetValue(2, 3, "H")
    FpSpread1.ActiveSheet.SortColumns(0, 2, sort)
    Label1.Text = "Is the sort ascending is " & b.ToString() & " and the type of comparer is " & Convert.ToString(c) & " and the
    index is " & i.ToString()
    
    See Also

    Reference

    SortInfo Class
    SortInfo Members

    User-Task Documentation

    Managing Sorting