The different primitive data types are Boolean, Char, Byte, Date, Decimal, Uinteger, Double, Integer, Long, Sbyte, Short, Single, String, Ulong & Ushort. To declare the variables the DIM statement is used. For illustration to say a variable sum is of integer type, either of the below statements can be used.
Dim sum As Integer
The common syntax for declaring a variable is Dim followed by the variable followed by As keyword followed by the datatype that is again a keyword. The table gives an idea of the other data types.
Table: The various data types in visual basic
Dim is used for declaring the variables in procedures. Every time the procedure is called, the data stored in the variables declared with this keyword are reset. The Static is used to declare the variables in procedures. Every time the procedure is called, the data stored in the static variables are retained.
Public is used to declare the variables within a module. The variable is accessible to all process in the project.
Private is used to declare the variables within a module. The variable is only accessible to process within the project.
ReDim: The keyword ReDim is used to re-dimension an array.