This statement declares variables and allocates storage space.
Dim varname[([subscripts])][, varname[([subscripts])]] . . .
upperbound [,upperbound] . . .
The lower bound of an array is always 0.
Variables declared with Dim at the module level are available to all procedures within the module. At the procedure level, variables are available only within the procedure.
You also can use the Dim statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. An error occurs if you try to redeclare a dimension for an array variable whose size is explicitly specified in a Dim statement.
Visual Basic for Windows CE initializes numeric variables to 0 and string variables to a zero-length string (""). When you use the Dim statement in a procedure, you must put the Dim statement at the beginning of the procedure.