Datasheet

In Figure 1-13, the Toolbox, Solution Explorer, Properties window, Errors List, and other secondary win-
dows have been hidden to make more room for the large Properties page. You can see these other win-
dows’ icons lurking along the left, right, and bottom edges of the figure.
Click the tabs on the left to view and modify different types of application settings. You can leave many
of the property values alone and many are set in other ways. For example, by default, the Assembly
name and Root namespace values shown in Figure 1-13 are set to the name of the project when you first
create it.
There are three properties on the Compile tab shown in Figure 1-14 that deserve special mention.
First, Option Explicit determines whether Visual Basic requires you to declare all variables before using
them. Leaving this option turned off can sometimes lead to subtle bugs. For example, the following code
is intended to print a list of even numbers between 0 and 10. Unfortunately, a typographical error makes
the
Debug.WriteLine statement print the value of the variable j not i. Because j is never initialized, the
code prints out a bunch of blank values. If you set Option Strict to On, the compiler complains that the
variable
j is not declared and the problem is easy to fix.
For i = 1 To 10
If i Mod 2 = 0 Then Debug.WriteLine(j)
Next i
Figure 1-13: Property pages let you set a project’s properties.
16
Chapter 1
571982 ch01_2.qxd 1/19/06 1:15 PM Page 16