VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Save and load list boxes

by PulseWave (25 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 24th February 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Save and load list boxes

Rate Save and load list boxes



'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)
'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



Download this snippet    Add to My Saved Code

Save and load list boxes Comments

No comments have been posted about Save and load list boxes. Why not be the first to post a comment about Save and load list boxes.

Post your comment

Subject:
Message:
0/1000 characters