Visual Basic Concepts
Introduction to the File System Object Model
A new feature for Visual Basic is the File System Object (FSO) object model, which provides an object-based tool for working with folders and files. This allows you to use the familiar
object.method syntax with a rich set of properties, methods, and events to process folders and files, in addition to using the traditional Visual Basic statements and commands.
The FSO object model gives your applications the ability to create, alter, move, and delete folders, or to detect if particular folders exist, and if so, where. It also enables you to gain information about folders, such as their names, the date they were created or last modified, and so forth.
The FSO object model makes processing files much easier as well. When processing files, your primary goal is to store data in a space- and resource-efficient, easy-to-access format. You need to be able to create files, insert and change the data, and output (read) the data. While you can store data in a database, such as Jet or SQL, it adds a significant amount of overhead to your application. For many reasons, you may not want to have such an overhead, or your data access requirements may not require all the extra features associated with a full-featured database. In this case, storing your data in a binary or text file is the most efficient solution.
The FSO object model, which is contained in the Scripting type library (Scrrun.Dll), supports text file creation and manipulation through the TextStream object. It does not as yet, however, support the creation or manipulation of binary files. To manipulate binary files, use the Open command with the Binary flag. Full information on how to manipulate binary files is contained in "Using Binary File Access" in this chapter.