Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Editing Files Opened for Random Access

Visual Studio .NET 2003

To edit a random-access file, first read records from the file into program variables, and then change the values in the variables. In Declaring Variables for Random File Access and Opening Files for Random Access, a hypothetical Employee Records database defined variables for reading and writing employee records. The following step describes how to read and copy employee records using those variables.

To read and copy records into variables

  • Use the FileGetObject Function, which copies a record from the Employee Records file into the Employee variable:
    FileGet(FileNum, Employee, Position)
    

    In this line of code, FileNum contains the number that the FileOpen Function used to open the file, Position contains the number of the record to copy, and Employee, declared as the user-defined type Person, receives the contents of the record.

See Also

Declaring Variables for Random File Access | Opening Files for Random Access | Writing Variables to Records | File Access with Visual Basic Run-Time Functions | Sequential File Access | Binary File Access | FilePutObject Function | FileGetObject Function

Show:
© 2015 Microsoft