This documentation is archived and is not being maintained.

File Handling for Visual Basic 6.0 Users

Visual Basic 2008 expands file-handling capabilities while providing compatibility with previous versions of Visual Basic file I/O functions.

In Visual Basic 6.0, file handling is accomplished using various file I/O functions such as Open, Input, Output, and Append. The FileSystemObject object provides an object-oriented method of working with files.

In Visual Basic 2008, file handling is accomplished through the My.Computer.FileSystem Object. In addition, the System.IO.File class includes functions that provide compatibility with the older Visual Basic file I/O functions.

The FileStream class provides access to standard input and output files and error devices.

The following table lists members of the My.Computer.FileSystem object available in Visual Basic 2008.

Member

Description

CombinePath

Returns a properly formatted combined path as a String.

CopyDirectory

Copies a directory.

CopyFile

Copies a file.

CurrentDirectory

Gets or sets the current directory.

CreateDirectory

Creates a directory.

DeleteDirectory

Deletes a directory.

DeleteFile

Deletes a file.

DirectoryExists

Returns a Boolean indicating whether a directory exists.

Drives

Returns a read-only collection of all available drive names.

FileExists

Returns a Boolean indicating whether a file exists.

FindInFiles

Returns a read-only collection of strings representing the names of files containing the specified text.

GetDirectories

Returns a String collection representing the path names of subdirectories within a directory.

GetDirectoryInfo

Returns a DirectoryInfo object for the specified path.

GetDriveInfo

Returns a DriveInfo object for the specified path.

GetFileInfo

Returns a FileInfo object for the specified path.

GetFiles

Returns a read-only String collection representing the names of files within a directory.

GetParentPath

Returns a String representing the absolute path of the parent of the provided path.

GetTempFileName

Creates a uniquely named zero-byte temporary file on disk and returns the full path of that file.

MoveDirectory

Moves a directory to the specified location.

MoveFile

Moves a file to the specified location.

OpenTextFieldParser

Opens a TextFieldParser.

OpenTextFileReader

Opens a TextReader.

OpenTextFileWriter

Opens a TextWriter.

ReadAllBytes

Reads from a binary file.

ReadAllText

Reads from a text file.

RenameDirectory

Renames a directory.

RenameFile

Renames a file.

SpecialDirectories

Gets an object that provides properties for accessing commonly referenced directories.

WriteAllBytes

Writes to a binary file.

WriteAllText

Writes to a text file.

Show: