O'Reilly logo

Special Edition Using Microsoft® Visual Basic® .NET by Jeff Spotts, Brian Siler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Declaring and Naming Variables

The first line of code is a Dim, or Dimension, statement, used for dimensioning (or declaring) variables. When your program declares a variable, it is, in essence, telling Visual Basic, “Set aside a memory location that will be used to store variable information; I will reference it by this name.” The last two words in the Dim statement tell Visual Basic what type of information you plan to store—in this case, integer numbers. This information helps determine how much memory is to be set aside for the variable.

Note

Variables also can be declared with other keywords besides Dim, such as Public and Private. For more details, see the section in Chapter 8, “Managing Program Tasks with Procedures,” called “Understanding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required