SALVAR LISTBOX

USUARIO.EXCLUIDOS 28/03/2005 21:05:53
#75467
Ola, como que eu faço para salvar todo conteúdo do listbox em txt, sem ser commondialog?

vlw
WEBMASTER 28/03/2005 21:24:13
#75469
Private Sub Form_click()
Open "c:\dado.txt" For Append As #1

For ncont = 0 To lstDados.ListCount - 1

Print #1, lstDados.List(ncont)

Next

Close #1
End Sub
USUARIO.EXCLUIDOS 28/03/2005 21:27:37
#75470
Tente isto :
=================================================
Sub LoadList(Lst As ListBox, file As String)
Rem Call LoadList (List1,"C:\Windows\System\Saved.lst")
On Error GoTo Error
Open file For Input As #1
Do Until EOF(1)
Input #1, a$
Lst.AddItem a$
Loop
Close 1
Exit Sub
error:
X = MsgBox("File Not Found", vbOKOnly, "Error")
End Sub

Sub SaveList(Lst As ListBox, file As String)
Rem Call SaveList (List1,"C:\Windows\System\Saved.lst")
On Error GoTo Error
Open file For Output As #1
For i = 0 To Lst.ListCount - 1
a$ = Lst.List(i)
Print #1, a$
Next
Close 1
Exit Sub
error:
X = MsgBox("There has been a error!", vbOKOnly, "Error")
End Sub
=========================
Valeu ?
USUARIO.EXCLUIDOS 28/03/2005 21:57:02
#75476
era isso mesmo vlw a todos..........
Tópico encerrado , respostas não são mais permitidas