Visual Basic - URGENTE pasar info listbox_1 al Listbox_2

Life is soft - evento anual de software empresarial
 
Vista:

URGENTE pasar info listbox_1 al Listbox_2

Publicado por nestor (94 intervenciones) el 14/10/2004 01:22:02
Tengo dos Listbox. En el ListBox_1 tengo informacion, necesito pasar esa informacion al ListBox_2. Utilizando un boton Cmd_pasartodo.
Es decir, al hacer 1 click en el boton que me pase toda la informacion que existe en el ListBox_1 al ListBox_2.
Necesito un codigo que me haga ese poceso.
Muchas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:URGENTE pasar info listbox_1 al Listbox_2

Publicado por miguel (1042 intervenciones) el 14/10/2004 01:59:43
Private Sub cmdPasarTodo_Click()
Dim I As Integer
For I = 0 To List1.ListCount - 1
List2.AddItem List1.List(I)
Next I
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:URGENTE pasar info listbox_1 al Listbox_2

Publicado por Ruri (583 intervenciones) el 14/10/2004 03:52:04
Nestor, el código que necesitás es este:

Dim k as long
Listbox_2.Clear
With Listbox_1
if .ListCount < 1 then exit sub
For k = 0 to .ListCount - 1
.ListIndex=k
ListBox_2.AddItem .Text
'Sólo si tenés algo guardao en la propiedad ItemData
ListBox_2.ItemData(ListBox_2.NewIndex) = .ItemData(k)
Next k
.ListIndex=0
ListBox_2.ListIndex=0
End With

Espero que te sirva
Saludos Ruri
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar