Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / SheetView Class / GetSelection Method
Index into the list of selections
Example


In This Topic
    GetSelection Method (SheetView)
    In This Topic
    Gets the selection on this sheet with the specified index.
    Syntax
    'Declaration
     
    Public Function GetSelection( _
       ByVal index As Integer _
    ) As CellRange
    'Usage
     
    Dim instance As SheetView
    Dim index As Integer
    Dim value As CellRange
     
    value = instance.GetSelection(index)
    public CellRange GetSelection( 
       int index
    )

    Parameters

    index
    Index into the list of selections

    Return Value

    CellRange object containing the range of cells for the specified selection
    Example
    This example illustrates the use of this member by returning the selection with the specified index.
    DialogResult dlg; 
    fpSpread1.ActiveSheet.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.MultiRange;
    fpSpread1.ActiveSheet.AddSelection(0, 0, 2, 2);
    fpSpread1.ActiveSheet.AddSelection(0, 3, 2, 2);
    dlg = MessageBox.Show("Do you want to get one of the selections?", "GetSelection", MessageBoxButtons.YesNo);
    if (dlg == DialogResult.Yes)
    {
        FarPoint.Win.Spread.Model.CellRange cr;
        cr = fpSpread1.ActiveSheet.GetSelection(1);
        label1.Text = "The selection covers cells " + cr.Row + ", " + cr.Column + ", " + cr.RowCount + ", " + cr.ColumnCount;
    }
    Dim dlg As DialogResult
    FpSpread1.ActiveSheet.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.MultiRange
    FpSpread1.ActiveSheet.AddSelection(0, 0, 2, 2)
    FpSpread1.ActiveSheet.AddSelection(0, 3, 2, 2)
    dlg = MessageBox.Show("Do you want to get one of the selections?", "GetSelection", MessageBoxButtons.YesNo)
    If dlg = DialogResult.Yes Then
        Dim cr As FarPoint.Win.Spread.Model.CellRange
        cr = FpSpread1.ActiveSheet.GetSelection(1)
        Label1.Text = "The selection covers cells " & cr.Row & ", " & cr.Column & ", " & cr.RowCount & ", " &     cr.ColumnCount
    End If
    See Also