Me extraña que se forme un bucle infinito, más bien sería que no hace nada, a no ser que falte algo más en el código.
El problema es que el If de "Añadir" debe estar fuera del segundo For:
Código vb:
Ver originalPublic Sub cargarDetalleOrdenCompra()
Try
'Aqui cargo el primer DataGridView
dgvDetalleRequisicionPS.DataSource = objetoOrdenCompra.buscarDetalleRequisicionProducto ServicioXIdProveedor(lblIdProveedorGeneral.Text)
'Aqui intento pasar los datos al otro Datagridview
For Each Fila1 As DataGridViewRow In dgvDetalleRequisicionPS.Rows
Dim Añadir As Boolean = True
For Each Fila2 As DataGridViewRow In dgvDetalleOrdenCompra.Rows
If Fila2.Cells("idItem").Value = Fila1.Cells("ID_SECUENCIAL_ITEM").Value.ToString Then
Fila2.Cells("cantidadProductoServicio").Value = CType(Fila2.Cells("cantidadProductoServicio").Valu e, Integer) + CType(Fila1.Cells("CANTIDAD").Value, Integer)
Añadir = False
Exit For
End If
Next
If Añadir = True Then
dgvDetalleOrdenCompra.Rows.Add(Fila1.Cells("ID_SECUENCIAL_ITEM").Value.ToString, Fila1.Cells("UMEDIDA_DETALLE_REQUISICION_PS").Value.ToString, Fila1.Cells("CANTIDAD").Value.ToString, "", "")
End If
Next
Catch ex As Exception
MsgBox("CARGAR DETALLE ORDEN DE COMPRA." & vbNewLine & ex.Message.ToString, MsgBoxStyle.Critical, "MENSAJE DE EXCEPCIÓN")
End Try
End Sub
Si sigue dando problemas, habría que ver que datos hay exactamente.