Share via


OpenMode Enumeration

Indicates how to open a file when calling file-access functions.

Remarks

When you call file access–related functions, you can use enumeration members in your code in place of the actual values.

The OpenMode enumeration defines constants used to set file access modes. The following table lists the OpenMode enumeration members.

Input, Output, and Append are used when sequentially accessing files, such as text files, while Binary is used for binary file access and Random for random file access.

When sequentially accessing a file, you cannot change its data. You can read the data, append to it, or overwrite it with new data. If you open it for input, the contents of the file will be overwritten, even if you do not directly write to the file.

When performing file I/O operations, the My.Computer.FileSystem object provides greater performance and ease of use than legacy file I/O methods. For more information, see My.Computer.FileSystem Object.

Members

Member

Description

Append

File opened to append to it. Default.

Binary

File opened for binary access.

Input

File opened for read access.

Output

File opened for write access.

Random

File opened for random access.

Requirements

Namespace: Microsoft.VisualBasic

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Tasks

How to: Refer to an Enumeration Member

Concepts

Intrinsic Constants and Enumerations

When to Use an Enumeration

Reference

OpenShare Enumeration

OpenAccess Enumeration