O'Reilly logo

Visual Basic® 2010 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. 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

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 using arbitrary numbers such as 1.

Input

Reads data written into a file by the Write method back into a variable.

InputString ...

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