Visual Basic Keywords and Syntax

Those with previous experience with Visual Basic are already familiar with many of the language keywords and syntax. However, not all readers will fall into this category, so this introductory section is for those new to Visual Basic. A glossary of keywords is provided, after which this section will use many of these keywords in context.

Although they're not the focus of the chapter, with so many keywords, a glossary follows. Table 1.1 briefly summarizes most of the keywords discussed in the preceding section, and provides a short description of their meaning in Visual Basic. Keep in mind there are two commonly used terms that aren't Visual Basic keywords that you will read repeatedly, including in the glossary:

1. Method—A generic name for a named set of commands. In Visual Basic, both subs and functions are types of methods.
2. Instance—When a class is created, the resulting object is an instance of the class's definition.

Table 1.1 Commonly Used Keywords in Visual Basic

Keyword Description
Namespace A collection of classes that provide related capabilities. For example, the System.Drawing namespace contains classes associated with graphics.
Class A definition of an object. Includes properties (variables) and methods, which can be Subs or Functions.
Sub A method that contains a set of commands, allows data to be transferred as parameters, and provides scope around local variables and commands, but does not return a value.
Function

Get Professional Visual Basic 2012 and .NET 4.5 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.