Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/06/2008, 14:28
forrestgump
 
Fecha de Ingreso: mayo-2008
Mensajes: 33
Antigüedad: 16 años
Puntos: 0
ayuda con dos listas

El caso es que cuando agrego nombres a la lista LIST2 y agregarlo a un archivo.TXT todo marcha muy bien pero necesito que cuando regrese algun otro momento al FORM y vuelva a agregar mas nombres esten ahi los nombres agregados anteriormente asi que hice otra lista llamada LIST3 como un respaldo para que se agregue a LIST2 pero al parecer mi problema son los INDEX.. como le puedo hacer ????

es este el codigo y desactive unas cosas porque estoy atorado en esto... ojo por favor ayudenme porfis..



Private Sub Command1_Click()

'List2.AddItem List3


List2.AddItem Text1.Text 'AGREGO A LA LISTA
'List3.AddItem Text1.Text
Text1.Text = "" 'LIMPIO TEXTBOX
List2.AddItem List2
'List3.AddItem List3

If List2.ListIndex = -1 Then Exit Sub
List2.RemoveItem List2.ListIndex

'If List3.ListIndex = -1 Then Exit Sub
'List3.RemoveItem List3.ListIndex

Call GuardarArchivo
End Sub

Private Sub GuardarArchivo()

Dim i As Integer 'AGREGO AL ARCHIVO NOMBRES1
Open "c:\malpica\nombres1.txt" For Output As #1
For i = 0 To List2.ListCount - 1
Print #1, List2.List(i)
Next i
Close #1

'Open "c:\malpica\nombres2.txt" For Output As #1 'AGREGO AL ARCHIVO NOMBRES2
'For i = 0 To List3.ListCount - 1
'Print #1, List3.List(i)
'Next i
'Close #1

End Sub

Private Sub Command2_Click() ' BOTON PARA ORDENAR ALFABETICAMENTE
List1.Clear
For x = 0 To (List2.ListCount - 1)
List1.AddItem List2.List(x)
Next
End Sub

Private Sub Command3_Click() ' BOTON PARA ELIMINAR VARIOS
List2.RemoveItem List2.MultiSelect - 1

End Sub

Private Sub Command4_Click() 'BOOTON PARA MODIFICAR
List2.RemoveItem List2.ListIndex
List2.AddItem Text2.Text

End Sub

Private Sub Command5_Click() ' BOTON PARA ELIMINAR UNO

List2.RemoveItem List2.ListIndex 'elimino de la lista2

Open "c:\malpica\nombres1.txt" For Output As #1 'elimino de archivo nombres1
For i = 0 To List2.ListCount - 1
Print #1, List2.List(i)
Next i
Close #1

List3.AddItem List2

'List3.RemoveItem List3.ListIndex 'elimino de la lista3
'Open "c:\malpica\nombres2.txt" For Output As #1 'elimino del archivo nombres2
'For i = 0 To List3.ListCount - 1
'Print #1, List3.List(i)
'Next i
'Close #1

End Sub

Private Sub Form_Load()

'Dim i As Integer
'Open "c:\malpica\nombres1.txt" For Output As #1
'For i = 0 To List3.ListCount - 1
'Print #1, List3.List(i)
'Next i
'Close #1
'List2.AddItem List3

End Sub