Siebel VB Language Reference > VB Language Reference >

VarType Function


This standard VB function returns the variant type of the specified variant variable.

Syntax

VarType(varName)

Argument
Description

varName

The name of the variant variable to query

Returns

The value returned by VarType is one of the following:

Ordinal
Representation

0

(Empty)

1

Null

2

Integer

3

Long

4

Single

5

Double

6

Currency

7

Date

8

String

9

Object

Example

This example returns the type of a variant.

Sub Button_Click
   Dim x
   Dim myarray(8)
   Dim retval
   Dim retstr
   myarray(1) = Null
   myarray(2) = 0
   myarray(3) = 39000
   myarray(4) = CSng(10^20)
   myarray(5) = 10^300
   myarray(6) = CCur(10.25)
   myarray(7) = Now
   myarray(8) = "Five"
   For x = 0 to 8
      retval = Vartype(myarray(x))
      Select Case retval
         Case 0
            retstr = " (Empty)"
         Case 1
            retstr = " (Null)"
         Case 2
            retstr = " (Integer)"
         Case 3
            retstr = " (Long)"
         Case 4
            retstr = " (Single)"
         Case 5
            retstr = " (Double)"
         Case 6
            retstr = " (Currency)"
         Case 7
            retstr = " (Date)"
         Case 8
            retstr = " (String)"
      End Select
      If retval = 1 then
         myarray(x) = "[null]"
      ElseIf retval = 0 then
         myarray(x) = "[empty]"
      End If
      Next x
End Sub

Related Topics

IsDate Function
IsEmpty Function
IsNull Function
IsNumeric Function

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.