SALVAR LISTBOX
Ola, como que eu faço para salvar todo conteúdo do listbox em txt, sem ser commondialog?
vlw
vlw
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
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
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 ?
=================================================
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 ?
era isso mesmo vlw a todos..........
Tópico encerrado , respostas não são mais permitidas