Using Value Types

In this paragraph you learn to use value types. The following demonstration assumes you have created a new Visual Basic project for the Console (see Chapter 2 for details). Listing 4.1 shows how you can declare variables storing value types. You can write the code inside the Main method for learning purposes.

Listing 4.1 Using Value Types


You can declare variables of the desired value types using the Dim keyword followed by the identifier of the variable and by the As clause that then requires the type specification.

Notes about Dim and As

Dim is the most important keyword for declaring variables and is commonly used in local ...

Get Visual Basic® 2010 Unleashed 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.