Spread Windows Forms 10.0 Product Documentation
SetColumnShowSortIndicator(Int32,Int32,Boolean) Method
Example 


Column index of the first column
Number of columns to set
Whether to display the sort indicators in the column headers
Sets whether the specified columns on this sheet should display a sort indicator when automatically sorted.
Syntax
'Declaration
 
Public Overloads Sub SetColumnShowSortIndicator( _
   ByVal column As Integer, _
   ByVal count As Integer, _
   ByVal showIndicator As Boolean _
) 
'Usage
 
Dim instance As SheetView
Dim column As Integer
Dim count As Integer
Dim showIndicator As Boolean
 
instance.SetColumnShowSortIndicator(column, count, showIndicator)
public void SetColumnShowSortIndicator( 
   int column,
   int count,
   bool showIndicator
)

Parameters

column
Column index of the first column
count
Number of columns to set
showIndicator
Whether to display the sort indicators in the column headers
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeException Specified column index is out of range; must be between -1 and the total number of columns
Remarks

This method must be called before the user does an AutoSortColumn. Otherwise, the sort indicator is displayed and remains displayed.

Example
This example sets the sort indicator for the specified column header if automatic sorting is allowed.
Random r = new Random();
int i, j;
DialogResult dlg;
bool b;
for (i = 0; i <= 200; i++)
{
    for (j = 0; j<=3; j++)
        fpSpread1.ActiveSheet.SetValue(i, j, r.Next().ToString());
}
fpSpread1.ActiveSheet.SetColumnShowSortIndicator(0, 4,  false);
fpSpread1.ActiveSheet.AutoSortColumn(0);
dlg = MessageBox.Show("Do you want to see the sort indicator?", "SetColumnShowSortIndicator", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
    fpSpread1.ActiveSheet.SetColumnShowSortIndicator(0, 4, true);
    fpSpread1.ActiveSheet.AutoSortColumn(0);
    fpSpread1.ActiveSheet.AutoSortColumn(1);
    fpSpread1.ActiveSheet.AutoSortColumn(2);
    fpSpread1.ActiveSheet.AutoSortColumn(3);
    b = fpSpread1.ActiveSheet.GetColumnShowSortIndicator(0);
    label1.Text = "The GetColumnShowSortIndicator for column 0 =  " + b.ToString();
}
Dim r As New Random()
Dim i, j As Integer
Dim dlg As DialogResult
Dim b As Boolean
For i = 0 To 20
    For j = 0 To 4
        FpSpread1.ActiveSheet.SetValue(i, j, r.Next.ToString())
    Next j
Next i
FpSpread1.ActiveSheet.SetColumnShowSortIndicator(0, 4, False)
FpSpread1.ActiveSheet.AutoSortColumn(0)
dlg = MessageBox.Show("Do you want to see the sort indicator?", "SetColumnShowSortIndicator", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
    FpSpread1.ActiveSheet.SetColumnShowSortIndicator(0, 4, True)
    FpSpread1.ActiveSheet.AutoSortColumn(0)
    FpSpread1.ActiveSheet.AutoSortColumn(1)
    FpSpread1.ActiveSheet.AutoSortColumn(2)
    FpSpread1.ActiveSheet.AutoSortColumn(3)
    b = FpSpread1.ActiveSheet.GetColumnShowSortIndicator(0)
    Label1.Text = "The GetColumnShowSortIndicator for column 0 =  " & b.ToString()
End If
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

SheetView Class
SheetView Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.