SUMMARY

Visual Basic provides a native set of methods for reading and writing files, including FreeFile, FileOpen, Input, LineInput, Print, Write, and FileClose. It also provides methods for working with the filesystem (such as ChDir, MkDir, Kill, and RmDir). If you have a lot of previous experience with Visual Basic, you may prefer these familiar methods.

The System.IO namespace offers many objects that provide even more powerful capabilities than the native Visual Basic methods. Classes such as Directory, DirectoryInfo, File, and FileInfo make it easy to create, examine, move, rename, and delete directories and files. The File class’s methods make it particularly easy to read or write an entire file and to create streams attached to files for reading or writing.

The FileSystemWatcher class lets an application keep an eye on a file or directory and take action when it is changed. For example, a program can watch a spooling directory and take action when a new file appears in it.

The Path class provides miscellaneous support for working with paths. For example, it provides methods for examining a path’s filename or extension, and for combining paths.

The My.Computer.FileSystem namespace provides shortcuts to some of the more useful of the methods offered by the other filesystem classes. Its methods let you create, examine, and delete files and directories. The SpecialDirectories object also provides information about the locations of system directories.

There is considerable overlap among all of these tools, so you don’t need to feel that you have to use them all. Take a good look so you know what’s there, and then pick the tools that you find the most comfortable.

The chapters in this book cover a wide variety of Visual Basic programming topics. In the first part of the book, Chapters 1 through 6 described the Visual Studio integrated development environment and many of the tools that you use to build Visual Basic programs. In the second part of the book, Chapters 7 through 21 explained basic topics of Visual Basic programming (such as the language itself, using standard controls, and drag and drop). In the third part of the book, Chapters 22 through 26 described object-oriented concepts (such as class and structure declaration, namespaces, and generics). In the fourth part of the book, Chapters 27 through 30 explained the ways a program can interact with its environment by printing and using techniques such as configuration files, the registry, streams, and filesystem objects.

The rest of this book contains appendices that provide a categorized reference for Visual Basic .NET. You can use them to quickly review the syntax of a particular command, select from among several overloaded versions of a routine, or refresh your memory about what a particular class can do.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.9.237