Foros del Web » Programación para mayores de 30 ;) » .NET »

De un Listbox a otro

Estas en el tema de De un Listbox a otro en el foro de .NET en Foros del Web. Bueno primero que nada he estado leyendo muchos post sobre este tema y me ha funcionado pero he quedado con varias dudas. Tengo dos listbox ...
  #1 (permalink)  
Antiguo 09/07/2010, 12:52
 
Fecha de Ingreso: enero-2010
Mensajes: 5
Antigüedad: 14 años, 3 meses
Puntos: 0
De un Listbox a otro

Bueno primero que nada he estado leyendo muchos post sobre este tema y me ha funcionado pero he quedado con varias dudas.

Tengo dos listbox que los lleno de la siguiente manera


Código:
    Private Sub CARGAR_LSB_EXISTENTES()
        Try

            If ENCABEZADOSComboBox.SelectedValue <> Nothing Then

                Dim SERVICIO As New ServiceMC.CASTA_MCWSSoapClient

                DSET_ASIGNADO.Clear()

                MENSA = SERVICIO.ERRORES

                If MENSA <> "0" Then
                    MsgBox(MENSA)
                Else
                    DSET_ASIGNADO = SERVICIO.MENU_EXISTENTES

                    DV_MENU_ASIGNADO.Table = DSET_ASIGNADO.Tables(0)

                    DV_MENU_ASIGNADO.RowFilter = String.Format(" PADRE = '{0}' ", ENCABEZADOSComboBox.SelectedValue)

                    MENU_EXISTENTESListBox.DataSource = DV_MENU_ASIGNADO
                    MENU_EXISTENTESListBox.DisplayMember = "HIJOS"
                    MENU_EXISTENTESListBox.ValueMember = "FORM_NAME"

                End If
            End If

        Catch ex As Exception

        End Try
    End Sub
Tengo otro listbox que lo lleno asi:
Código:
   Private Sub CARGAR_LSB_ASIGNADOS()
        Try

            If ENCABEZADOSComboBox.Text.Trim <> Nothing Then


                Dim DV As New DataView

                Dim SERVICIO As New ServiceMC.CASTA_MCWSSoapClient
                Dim DSET As New DataSet
                DSET.Clear()

                MENSA = SERVICIO.ERRORES

                If MENSA <> "0" Then
                    MsgBox(MENSA)
                Else

                    DSET = SERVICIO.MENU_USUARIO

                    DV.Table = DSET.Tables(0)

                    DV.RowFilter = " COD_TIPUSU = '" & USUARIOSListBox.SelectedValue & _
                                    "' AND PADRE= '" & ENCABEZADOSComboBox.Text.Trim & "'"

                    MENU_ASIGNADOSListBox.DataSource = DV
                    MENU_ASIGNADOSListBox.DisplayMember = "HIJOS"
                    MENU_ASIGNADOSListBox.ValueMember = "COD_MENU"



                End If
            End If

        Catch ex As Exception

        End Try
    End Sub
Vaya lo que sucede es que quiero pasar los datos desde MENU_EXISTENTESListBox a MENU_ASIGNADOSListBox, solamente los que selecciono, ahorita estoy probando uno por uno con este codigo.

Código:
   Private Sub ENLAZAR_DATOS()
        Try
            MENU_ASIGNADOSListBox.Items.Add(MENU_EXISTENTESListBox.SelectedItem)
        Catch ex As Exception
            MessageBox.Show(ex.Message, _
                                  NOM_EMPRESA.Trim, _
                                  MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
Vaya pero al pasar al MENU_EXISTENTESListBox me sale este error.

System.Data.DataRowView

Encontes no se cual sera el error

Espero me puedan ayudar.
  #2 (permalink)  
Antiguo 09/07/2010, 13:31
Avatar de Darkavender  
Fecha de Ingreso: septiembre-2008
Ubicación: SLV
Mensajes: 125
Antigüedad: 15 años, 7 meses
Puntos: 4
Respuesta: De un Listbox a otro

Prueba agregando el .ToString

Código vb:
Ver original
  1. ListBox2.Items.Add(ListBox1.SelectedItem.ToString)
  #3 (permalink)  
Antiguo 09/07/2010, 15:28
 
Fecha de Ingreso: enero-2010
Mensajes: 5
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: De un Listbox a otro

No ya lo habia probado y tampoco funciona la verdad no encuentro porque me da este error

Etiquetas: listbox
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:45.