I am trying to check for multiple selections in a DataGridView with a For... Next Loop, but even though I have selected multiple rows, the only row with the property Selected=True is the first row in the selection. Is there a way around this?
MultiSelect is true on the DataGridView.
My code is as follows:
For Each dr As DataGridViewRow In dgv.Rows
If dr.Selected = True Then
intSelectedRow = dr.Index
SetTime("KeyEntry", dgv.Name, intSelectedRow)
Dim selectedItems As DataGridViewSelectedRowCollection = dgv.SelectedRows For Each selectedItem As DataGridViewRow In selectedItems 'Add code to handle whatever you want for each row Next End Sub