To load or save to file/listbox:
Code:Private Sub List_Load(TheList As ListBox, FileName As String) On Error Resume Next Dim TheContents As String Dim fFile As Integer fFile = FreeFile Open FileName For Input As fFile Do Line Input #fFile, TheContents$ TheList.AddItem TheContents$ Loop Until EOF(fFile) Close fFile End Sub Call List_Load(List1, "C:\MyFile.txt") Private Sub List_Save(TheList As ListBox, FileName As String) On Error Resume Next Dim Save As Long Dim fFile As Integer fFile = FreeFile Open FileName For Output As fFile For Save = 0 To TheList.ListCount - 1 Print #fFile, TheList.List(Save) Next Save Close fFile End Sub Call List_Save(List1, "C:\MyFile.txt")




Reply With Quote