title: Getting RowIndex based on the selected cells on a DataGridView
body: <p>I'm trying to get the row indices based on my selected cells on a DataGridView. How can I do that in VB.NET?</p>
  
  <p>This is what I have:</p>
  
  <pre><code> Dim iRowIndex As Integer
   For i = 0 To Me.grdTransaction.SelectedCells.Item(iRowIndex)
     iRowIndex = Me.grdTransaction.SelectedCells.Item(i).RowIndex.ToString()
     Dim s As String = Me.grdTransaction.SelectedRows(i).Cells("DataGridViewTextBoxColumn6").Value
     aList.Add(s)
  
     MsgBox("Row index " &amp; iRowIndex)
   Next
  </code></pre>