ComponentOne FlexPivot for WinForms
C1.Win.FlexPivot.4.8 Assembly / C1.Win.FlexPivot Namespace / C1FlexPivotGrid Class / Selection Property

In This Topic
    Selection Property (C1FlexPivotGrid)
    In This Topic
    Gets the current selected range in normalized form.
    Syntax
    'Declaration
     
    Public Overridable ReadOnly Property Selection As CellRange
    public virtual CellRange Selection {get;}
    Remarks
    The range returned corresponds to the current selection, defined by the C1.Win.C1FlexGrid.C1FlexGridBase.Row, C1.Win.C1FlexGrid.C1FlexGridBase.Col, C1.Win.C1FlexGrid.C1FlexGridBase.RowSel, and C1.Win.C1FlexGrid.C1FlexGridBase.ColSel properties. The range is normalized, so range.r1 <= range.r2 and range.c1 <= range.c2. This makes it easy to loop through the selection. For example: int total = 0; CellRange rg = flex.Selection; for (int r = rg.r1; r <= rg.r2; r++) for (int c = rg.c1; c <= rg.c2; c++) total += (int)flex[r,c]; Console.WriteLine("The total is: {0}", total);
    See Also