You look tired. Why don't you take a five-minute break, and then we'll dive into the project code.
Welcome back! In this chapter, we'll use the data type and function features we read about to design some general support routines that will be used throughout the program. All of this code will appear in a Visual Basic module named
General, all stored in a project file named General.vb.
Load the Chapter 6 (Before) Code project, either through the New Project templates or by accessing the project directly from the installation directory. To see the code in its final form, load Chapter 6 (After) Code instead.
I've already added the General.vb file with its module starting and ending blocks.
Friend Module General End Module
All the code we add in this chapter will appear between these two lines. Remember, modules are a lot like classes and structures, but you can't create instances of them; all their members are shared with all parts of your source code. This allows them to be used anywhere in the application. We don't need to do anything special to make them available to the entire program, other than to set the access level of each member as needed.
First, we'll add some general constants used throughout the program. Back in Visual Basic 6.0, I would have called these "global constants." But now they are simply shared members of the
General module. Add the following code just below the
Module General statement.
Insert Chapter 6, Snippet Item 1.
' ----- Public ...