Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/03/2007, 16:15
Avatar de pmuruaga
pmuruaga
 
Fecha de Ingreso: diciembre-2005
Mensajes: 127
Antigüedad: 19 años, 3 meses
Puntos: 0
Re: Problema con un par de dataset que se tranfieren datos.

Ahi creo que me quedo bien, al menos hice varias pruebitas y no fallo. Esperemos siga asi, y no cuando venga el jefe se plante, jaja.
Asi fue como me quedo:

Código:
    Public Sub pasarDeUnDataSetAOtro(ByVal origen As DataGridView, ByVal destino As DataGridView)
        Dim cuantasSelecciono As Integer
        cuantasSelecciono = origen.Rows.GetRowCount(DataGridViewElementStates.Selected)

        Dim cuantasTotal As Integer
        cuantasTotal = origen.Rows.GetRowCount(DataGridViewElementStates.Displayed)

        Dim ds_origen As DataSet = origen.DataSource
        Dim ds_destino As DataSet = destino.DataSource

        If cuantasSelecciono > 0 Then
            Dim i As Integer
            For i = 0 To cuantasSelecciono - 1
                Dim valor1 = origen.SelectedRows.Item(0).Cells(0).Value
                Dim j = 0
                For j = 0 To cuantasTotal - 1
                    If ds_origen.Tables(0).Rows(j).Item(0) = valor1 Then
                        Dim filaACopiar As DataRow = ds_origen.Tables(0).Rows.Item(j)
                        ds_destino.Tables(0).ImportRow(filaACopiar)
                        ds_origen.Tables(0).Rows.Remove(filaACopiar)
                        Exit For
                    End If
                Next
            Next
        End If
    End Sub
Muchisimas gracias por la pista reel. Te debo una.