Appendix U. File-System Classes
A Visual Basic application can take three basic approaches to file system manipulation: Visual Basic methods, System.IO Framework classes, and the My.Computer.FileSystem namespace. This appendix summarizes the properties, methods, and events provided by these approaches. For more information on file system objects, see Chapter 38, "File-System Objects."
VISUAL BASIC METHODS
The following table summarizes the Visual Basic methods for working with files. They let a program create, open, read, write, and learn about files.
METHOD | PURPOSE |
---|---|
Method | Purpose |
| Returns True if the file is at the end of file. |
| Closes an open file. |
| Reads data from a file opened in Random and Binary mode into a variable. |
| Reads data as an object from a file opened in Random and Binary mode into a variable. |
| Opens a file for reading or writing. Parameters indicate the mode (Append, Binary, Input, Output, or Random), access type (Read, Write, or ReadWrite), and sharing (Shared, LockRead, LockWrite, or LockReadWrite). |
| Writes data from a variable into a file opened for Random or Binary access. |
| Writes an object from a variable into a file opened for Random or Binary access. |
| Returns a file number that is not currently associated with any file in this application. You should use FreeFile to get file numbers rather than using arbitrary numbers such as 1. |
| Reads data written into a file by the Write method back into a variable. |
|
Get Visual Basic® 2010 Programmer's Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.