File Access with Visual Basic .NET
The .NET System.IO model provides an object-based tool for working with folders and files. Like FileSystemObject (as described in Accessing Files with FileSystemObject ), it allows you to use standard object.method syntax — with its own set of properties, methods, and events — to process text and data, giving your applications the ability to read from and write to files easily.
The .NET System.IO namespace includes a class library that facilitates string, character, and file manipulation. These classes contain properties, methods, and events for creating, copying, moving, and deleting files. And, since both strings and numeric data types are supported, they also allow you to incorporate data types in files. The most commonly used classes are FileStream, BinaryReader, BinaryWriter, StreamReader, and StreamWriter.
In This Section
- File Access Through the FileStream Class
- Provides information about general file-access issues.
- File Access Through BinaryReader and BinaryWriter Classes
- Describes how to manipulate binary data types.
- File Access Through StreamReader and StreamWriter Classes
- Describes how to handle string data types.
- Drive and Folder Access
- Describes how to work with drives and folders via the Directory class.
- Walkthrough: Manipulating Files Using .NET Framework Methods
- Demonstrates file access using the StreamReader and StreamWriter classes.
Demonstrates how to write to a text file.