System.Windows.Forms.DataGridView.SelectedRows Property

Gets the collection of rows selected by the user.

Syntax

[System.ComponentModel.Browsable(false)]
public DataGridViewSelectedRowCollection SelectedRows { get; }

Value

Documentation for this section has not yet been entered.

Remarks

The DataGridView.SelectionMode property must be set to DataGridViewSelectionMode.FullRowSelect or DataGridViewSelectionMode.RowHeaderSelect for the DataGridView.SelectedRows property to be populated with selected rows.

This property contains a read-only snapshot of the selection at the time it is referenced. If you hold onto a copy of this collection, it may differ from the actual, subsequent System.Windows.Forms.DataGridView state in which the user may have changed the selection. You should therefore not operate on a copy of the collection.

To programmatically select a row, set its DataGridViewRow.Selected property to true.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0