O'Reilly logo

Visual Basic 2012 Programmer's Reference by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix U

Filesystem Classes

A Visual Basic application can take three basic approaches to filesystem 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 filesystem objects, see Chapter 30, “Filesystem 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
EOF Returns True if the file is at the end of file.
FileClose Closes an open file.
FileGet Reads data from a file opened in Random and Binary mode into a variable.
FileGetObject Reads data as an object from a file opened in Random and Binary mode into a variable.
FileOpen 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).
FilePut Writes data from a variable into a file opened for Random or Binary access.
FilePutObject Writes an object from a variable into a file opened for Random or Binary access.
FreeFile 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 use arbitrary numbers such as 1.
Input Reads data written into a file by the Write method back ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required