You can still use the type specifiers, of course, but if you want to update your code, it would look like this:
Dim ratx(2, 2) As Integer, raty(2, 2) As Integer, ratpos(2, 2) As Integer
The type specifiers and corresponding data types are:
% - Integer
& - Long
! - Single
# - Double
$ - String
Other data types (e.g. Date, Boolean) were never assigned a type specifier.
Type specifiers occur in 5 contexts that I can think of.
1. In Dim statements; translate as shown above.
2. After variables names elsewhere in code; just remove the type specifier character.
3. In Const statements, after the constant value; translate as follows:
Const Pi = 3.14159# -> Const Pi As Double = 3.14159
4. (Rare) After function names in their declarations; translate as follows:
Function F!(Value As Integer) -> Function F(Value As Integer) As Single
5. (Rare) After function names in function calls; just remove the type specifier character.
Just for completeness and history: There also is a Deftype statement that you can place in the General Section of a Module and that types a variable, based on its initial character.
DefStr A - Q defines all module's variables that start with letters A through Q as Strings.
Other Deftypes are: DefBool, DefByte, DefInt, DefLng, DefCur, DefSng, DefDbl, DefDate, DefObj and DefVar.
This too is history: The statement is no longer supported (and for good reasons) in VB.NET
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.