DefType
Specifies default data types for arguments to data types for specified strings
A DefType statement only affects variables in that particular module.
Using this statement will affect arguments passed to procedures and the return type for Function and Property Get procedures.
This can be used at module level to set the default data type for variables or arguments passed to procedures or functions.
As you already know the default data type is Variant.
These can be used to define the default data type for a particular module.
The syntax for the string statement is:
[DefStr letterrange [, letterrange] [,]]
where letterrange can be letter1 [-letter2] (ie Defstr A - Q).
Data Types Available
There are 12 possible statements for boolean, byte, integer, long, currency, single, double, decimal, date, string, object, variant.
DefBool | Defines the variable prefix that should default to a Boolean data type. |
DefByte | Defines the variable prefix that should default to a Byte data type. |
DefInt | Defines the variable prefix that should default to a Integer data type. |
DefLng | Defines the variable prefix that should default to a Long data type. |
DefCur | Defines the variable prefix that should default to a Currency data type. |
DefSng | Defines the variable prefix that should default to a Single data type. |
DefDbl | Defines the variable prefix that should default to a Double data type. |
DefDec | Defines the variable prefix that should default to a Decimal data type. |
DefDate | Defines the variable prefix that should default to a Date data type. |
DefStr | Defines the variable prefix that should default to a String data type. |
DefObj | Defines the variable prefix that should default to a Object data type. |
DefVar | Defines the variable prefix that should default to a Variant data type. |
Examples
This example defines any variables that start with a letter between A and Q are to have a string data type.
DefStr A-Q
Message = "This is a warning"
DefBool "B"
Bnum = 0
Important
DefType statements do not affect user defined types.
This is not good prograaming practice and using these statements should be avoided.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext