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
DefByte 
DefInt 
DefLng 
DefCur 
DefSng 
DefDbl 
DefDec 
DefDate 
DefStr 
DefObj 
DefVar 

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.
A DefType statement only affects variables in that particular module.


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext