Wednesday, December 19, 2007

How to use the variable declarations

How to use the variable declarations

Each of the following statements can be used to explicitly declare a variable’s type:

Dim varname [As vartype] [ , varname2 [As vartype2]]

Private varname [As vartype] [ ,varname2 [As vartype2]]

Static varname [As vartype ] [ , varname2 [As vartype]]

Public varname [As vartype] [ , varname2 [As vartype2]]

Dim, Private, Static, and Public are Visual Basic keyword that define how and where the variable can be used. varname and varname2 represent the names of the variables that you want to declare. As indicated in the syntax, you can specify multiple variables in the same statement, as long as you separate the variables by commas.

Vartype and vartype2 represent the type definition of the respective variables. The type definition is a keyword, which tells VB what kind of information will be stored in the variable.

No comments: