Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel VB Language Reference > Siebel VB Language Reference >
Deftype Statement
This standard VB statement specifies the default data type for one or more variables.
Syntax
DefCur varTypeLetters
DefInt varTypeLetters
DefLng varTypeLetters
DefSng varTypeLetters
DefDbl varTypeLetters
DefStr varTypeLetters
DefVar varTypeLettersReturns
Not applicable
Usage
VarTypeLetters can be a single letter, a comma-separated list of letters, or a range of letters. For example, a-d indicates the letters a, b, c, and d.
The case of the letters is not important, even in a letter range. The letter range a-z is treated as a special case: it denotes all alpha characters, including the international characters.
The Deftype statement affects only the module in which it is specified. It must precede any variable definition within the module.
Variables defined using a Global or Dim statement can override the Deftype statement by using an As clause or a type character.
Example
This example finds the average of bowling scores entered by the user. Because the variable average begins with A, it is defined as a single-precision floating point number. The other variables are defined as integers.
DefInt c,s,t
DefSng a
Sub Button_Click
Dim count
Dim total
Dim score
Dim average
Dim msgtext
For count = 0 to 4
score = 180
total = total + score
Next count
average = total/count
msgtext = "Your average is: " &average
End SubSee Also
Declare Statement
Dim Statement
Global Statement
Let (Assignment Statement)
Type Statement
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel VB Language Reference Published: 18 June 2003 |