Export (0) Print
Expand All

OpenMode Enumeration

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

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public enum class OpenMode

Member nameDescription
InputFile opened for read access.
OutputFile opened for write access.
RandomFile opened for random access.
AppendFile opened to append to it. Default.
BinaryFile opened for binary access.

When you call file access–related functions, you can use enumeration members in your code instead 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, whereas Binary is used for binary file access and Random for random file access. For examples, see the FileOpen method.

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 better performance and ease of use than earlier file I/O methods. For more information, see FileSystem object.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft