Results 1 to 4 of 4

Thread: Sequential access file...need help!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Location
    Ohio
    Posts
    8

    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!

    Raye...

  2. #2
    jim mcnamara
    Guest
    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

  3. #3
    Junior Member
    Join Date
    Jun 2001
    Posts
    28
    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Location
    Ohio
    Posts
    8

    Smile 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!
    Raye...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width