Skip to main content

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

Yo utilice este metodo cuando quiero eliminar ,lo utilizo para maximo 5 objetos pero se podria usar una lista  . Llamo el metodo hacer click al boton 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

Yo utilice este método cuando quiero eliminar ,lo utilizo para máximo 5 objetos pero se podría usar una lista. 

Llamo el metodo hacer click al botó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
Origen Enlace

Yo utilice este metodo cuando quiero eliminar ,lo utilizo para maximo 5 objetos pero se podria usar una lista . Llamo el metodo hacer click al boton 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