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.

DefBoolDefines the variable prefix that should default to a Boolean data type.
DefByteDefines the variable prefix that should default to a Byte data type.
DefIntDefines the variable prefix that should default to a Integer data type.
DefLngDefines the variable prefix that should default to a Long data type.
DefCurDefines the variable prefix that should default to a Currency data type.
DefSngDefines the variable prefix that should default to a Single data type.
DefDblDefines the variable prefix that should default to a Double data type.
DefDecDefines the variable prefix that should default to a Decimal data type.
DefDateDefines the variable prefix that should default to a Date data type.
DefStrDefines the variable prefix that should default to a String data type.
DefObjDefines the variable prefix that should default to a Object data type.
DefVarDefines 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