Yo utilice este metodométodo cuando quiero eliminar ,lo utilizo para maximomáximo 5 objetos pero se podriapodría usar una lista .
Llamo el metodo hacer click al botonbotón de aceptar
Private Sub ElementosSeleccionados(aux As DataGridView) Dim id, i As Integer Dim idList(5) For Each selectedItem As DataGridViewRow In aux.SelectedRows 'show ids of multiple selected rows id = selectedItem.Cells("ID").Value idList(i) = id i += 1 Next selectedItem Dim sResult As String = "" For Each elem As String In idList sResult &= elem & ", " Next MsgBox("Seleccionados" & sResult) End Sub
Private Sub ElementosSeleccionados(aux As DataGridView)
Dim id, i As Integer
Dim idList(5)
For Each selectedItem As DataGridViewRow In aux.SelectedRows
'show ids of multiple selected rows
id = selectedItem.Cells("ID").Value
idList(i) = id
i += 1
Next selectedItem
Dim sResult As String = ""
For Each elem As String In idList
sResult &= elem & ", "
Next
MsgBox("Seleccionados" & sResult)
End Sub