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.
Visual Basic 6.0
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.
Visual Basic 2008
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 |
---|---|
Returns a properly formatted combined path as a String. |
|
Copies a directory. |
|
Copies a file. |
|
Gets or sets the current directory. |
|
Creates a directory. |
|
Deletes a directory. |
|
Deletes a file. |
|
Returns a Boolean indicating whether a directory exists. |
|
Returns a read-only collection of all available drive names. |
|
Returns a Boolean indicating whether a file exists. |
|
Returns a read-only collection of strings representing the names of files containing the specified text. |
|
Returns a String collection representing the path names of subdirectories within a directory. |
|
Returns a DirectoryInfo object for the specified path. |
|
Returns a DriveInfo object for the specified path. |
|
Returns a FileInfo object for the specified path. |
|
Returns a read-only String collection representing the names of files within a directory. |
|
Returns a String representing the absolute path of the parent of the provided path. |
|
Creates a uniquely named zero-byte temporary file on disk and returns the full path of that file. |
|
Moves a directory to the specified location. |
|
Moves a file to the specified location. |
|
Opens a TextFieldParser. |
|
Opens a TextReader. |
|
Opens a TextWriter. |
|
Reads from a binary file. |
|
Reads from a text file. |
|
Renames a directory. |
|
Renames a file. |
|
Gets an object that provides properties for accessing commonly referenced directories. |
|
Writes to a binary file. |
|
Writes to a text file. |
See Also
Concepts
Parsing Text Files with the TextFieldParser Object
Programming Element Support Changes Summary
Reference
My.Computer.FileSystem.SpecialDirectories Object
Other Resources
Reading from Files in Visual Basic
Writing to Files in Visual Basic
Creating, Deleting, and Moving Files and Directories in Visual Basic