# C1.Win.FlexGrid.RowCollection.Selected

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_RowCollection_Selected_" data-uid="C1.Win.FlexGrid.RowCollection.Selected*">Selected Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_RowCollection_Selected_" data-uid="C1.Win.FlexGrid.RowCollection.Selected*"></a>
<h4 id="C1_Win_FlexGrid_RowCollection_Selected" data-uid="C1.Win.FlexGrid.RowCollection.Selected">Selected</h4>
<div class="markdown level1 summary"><p>Gets a collection of <a class="xref" href="C1.Win.FlexGrid.Row.html">Row</a> objects that are currently selected.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[Browsable(false)]
public RowCollection Selected { get; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;Browsable(False)&gt;
Public ReadOnly Property Selected As RowCollection</code></pre>
</div>
<h5 id="C1_Win_FlexGrid_RowCollection_Selected_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This property is especially useful when the grid's <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.SelectionMode.html#C1_Win_FlexGrid_C1FlexGridBase_SelectionMode">SelectionMode</a> property
is set to <a class="xref" href="C1.Win.FlexGrid.SelectionModeEnum.html#C1_Win_FlexGrid_SelectionModeEnum_ListBox">ListBox</a>.</p>
</div>
<h5 id="C1_Win_FlexGrid_RowCollection_Selected_examples">Examples</h5>
<p>The code below removes all selected rows from the grid.</p>
<p>Note that foreach loops can't be used to modify the collections being iterated over. This example
works because the <a class="xref" href="C1.Win.FlexGrid.RowCollection.Selected.html#C1_Win_FlexGrid_RowCollection_Selected">Selected</a> collection is being enumerated while the
<a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.Rows.html#C1_Win_FlexGrid_C1FlexGridBase_Rows">Rows</a> collection is being modified.</p>
<pre><code class="lang-csharp">// delete all selected rows
foreach (Row r in _flex.Rows.Selected)
{
    _flex.Rows.Remove(r);
}</code></pre>

</div>
