|
-
Jun 9th, 2001, 06:38 PM
#1
Thread Starter
New Member
Sequential access file...need help!
I've written an address book program using sequential access. I can get it to read the first record and can write to the file. Can anyone tell me how to move thru the records to view them (previous and next) and how to delete a record from the file?
Thanks loads!
-
Jun 9th, 2001, 07:18 PM
#2
You need to keep the records in an array in memory. Sequential access for text won't really allow you to jump to a record.
Consider reading up on random access files - files with fixed record lengths and fields like Name, Address, City, State, defined in a UDT. MSDN has a nice section on how to do this for a sample address book program.
one way to read in an array from a file-
Code:
Dim arr() as String
Open mfile for input as #1
Do while not eof(1)
line input #1, a$
Redim Preserve arr(ubound(arr) + 1)
arr(ubound(arr) ) = a$
Loop
Close #1
-
Jun 9th, 2001, 07:20 PM
#3
Junior Member
Well, I dont know if this program still works, i made it a while ago in VB5. But I figured its worth a shot. Good Luck
-
Jun 10th, 2001, 08:22 AM
#4
Thread Starter
New Member
Thank You!
Thanks for your help! I got my program working, now just need to get the delete to delete a record only vs. the whole file. Have a great day!
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
|