GrapeCity MultiRow Windows Forms Documentation
SelectedRows Property
Example 


Gets the collection of rows selected by the user.
Syntax
<BrowsableAttribute(False)>
<FeatureAttribute(Name="UISelection", Version="v5.0")>
Public ReadOnly Property SelectedRows As SelectedRowCollection
Dim instance As GcMultiRow
Dim value As SelectedRowCollection
 
value = instance.SelectedRows
[Browsable(false)]
[Feature(Name="UISelection", Version="v5.0")]
public SelectedRowCollection SelectedRows {get;}

Property Value

A SelectedRowCollection value that contains the rows selected by the user.
Remarks
This property contains a read-only snapshot of the selection at the time it is referenced. If you keep a copy of this collection, it may differ from the actual, subsequent GcMultiRow state in which the user may have changed the selection; therefore, you should not operate on a copy of the collection.
Example
The following code example shows how to use this property to retrieve the selection information. This code example is part of a larger example provided for the ViewMode class.
void getSelectionInformationButton_Click(object sender, EventArgs e)
        {
            string info = null;

            // Get a specific cell's selection state.
            info = "First Cell's Selection State: " + gcMultiRow1[0, 0].Selected;

            info += "\r\n\r\n";

            // Get a specific row's selection state.
            info += "First Row's Selection State: " + gcMultiRow1.Rows[0].Selected;

            info += "\r\n\r\n";

            info += "Selected cells List:";

            // Get all selected cell list.
            foreach (Cell cell in this.gcMultiRow1.SelectedCells)
            {
                info += "\r\n";

                info += "RowIndex: " + cell.RowIndex + ", CellIndex: " + cell.CellIndex;
            }

            info += "\r\n\r\n";

            info += ("Selected rows List:");

            // Get all selected row list.
            foreach (Row row in this.gcMultiRow1.SelectedRows)
            {
                info += "\r\n";

                info += "RowIndex: " + row.Index;
            }

            MessageBox.Show(info);
        }
Private Sub getSelectionInformationButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles 
getSelectionInformationButton.Click
        Dim info As String = Nothing

        ' Get a specific cell's selection state.
        info = "First Cell's Selection State: " + gcMultiRow1(0, 0).Selected.ToString()

        info += vbCr & vbLf & vbCr & vbLf

        ' Get a specific row's selection state.
        info += "First Row's Selection State: " + gcMultiRow1.Rows(0).Selected.ToString()

        info += vbCr & vbLf & vbCr & vbLf

        info += "Selected cells List:"

        ' Get all selected cell list.
        For Each cell As Cell In Me.gcMultiRow1.SelectedCells
            info += vbCr & vbLf

            info += "RowIndex: " + cell.RowIndex.ToString() + ", CellIndex: " + cell.CellIndex.ToString()
        Next

        info += vbCr & vbLf & vbCr & vbLf

        info += ("Selected rows List:")

        ' Get all selected row list.
        For Each row As Row In Me.gcMultiRow1.SelectedRows
            info += vbCr & vbLf

            info += "RowIndex: " + row.Index.ToString()
        Next

        MessageBox.Show(info)
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GcMultiRow Class
GcMultiRow Members
SelectedCells Property

 

 


Copyright © GrapeCity, inc. All rights reserved.