|
-
Oct 1st, 2000, 06:49 PM
#1
Thread Starter
New Member
I need a little help with coding out a project. I have it running fine all kinds of whistles and bells except for one thing. I can not get my menu save and open buttons to work. I need to save data from a list box to a file then load it back when i restart the project. Any ideas out there?
Thanks,
Kelly
-
Oct 1st, 2000, 07:27 PM
#2
You could use a flat file to store the list items in, i.e.
Code:
Private Sub Form_Load()
Dim iFile As Integer
Dim sItem As String
If Len(Dir(App.Path & "\List.dat")) Then
iFile = FreeFile
Open App.Path & "\List.dat" For Input As iFile
While Not EOF(iFile)
Input #iFile, sItem
List1.AddItem sItem
Wend
Close iFile
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim iFile As Integer
Dim lCount As Long
iFile = FreeFile
Open App.Path & "\List.dat" For Output As iFile
For lCount = 0 To List1.ListCount - 1
Print #iFile, List1.List(lCount)
Next
Close iFile
End Sub
-
Oct 2nd, 2000, 08:12 PM
#3
Thread Starter
New Member
The save file works fine, but not the open part. I am using mnuOpen click event to open the file. I can see the saved file but can't quite seem to open it. Thanks for the help and if you have any more ideas as to how to open the file in a click event it would be helpful. I suck at files but can do some pretty decent forms (for a begginer)
Kelly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|