Datasheet

Dim line = Console.ReadLine()
End Sub
End Module
A Module isn t truly a class, but rather a block of code that can contain methods, which are then referenced
by code in classes or other modules or, as in this case, it can represent the execution start for a program.
A Module is similar to having a Shared class. The Shared keyword indicates that only a single instance of a
given item exists.
For example in C# the
Static keyword is used for this purpose, and can be used to indicate that only a single
instance of a given class exists. Visual Basic doesn t support the use of the Shared keyword with a Class
declaration; instead Visual Basic developers create modules that provide the same capability. The Module
represents a valid construct to group methods that don t have state - related or instance - specifi c data.
Note a console application focuses on the
Console Class . The Console Class encapsulates Visual Basic s
interface with the text - based window that hosts a command prompt from which a command - line program is run.
The console window is best thought of as a window encapsulating the older non - graphical style user interface,
whereby literally everything was driven from the command prompt. A Shared instance of the Console class is
automatically created when you start your application, and it supports a variety of Read and Write methods. In
the preceding example, if you were to run the code from within Visual Studio s debugger, then the console window
would open and close immediately. To prevent that, you include a fi nal line in the Main Sub , which executes a
Read statement so that the program continues to run while waiting for user input.
Creating a Project from a Project Template
While it is possible to create a Visual Basic application working entirely outside of Visual Studio 2010,
it is much easier to start from Visual Studio 2010. After you install Visual Studio you are presented with
a screen similar to the one shown in Figure 1 - 1. Different versions of Visual Studio may have a different
overall look, but typically the start page lists your most recent projects on the left, some tips for getting
started, and a headline section for topics on MSDN that might be of interest. You may or may not
immediately recognize that this content is HTML text; more important, the content is based on an RSS feed
that retrieves and caches articles appropriate for your version of Visual Studio.
FIGURE 1 - 1
Visual Basic Keywords and Syntax
11
CH001.indd 11CH001.indd 11 4/5/10 11:56:15 AM4/5/10 11:56:15 AM