Siebel VB Language Reference > VB Language Reference >
Typeof Function
This standard VB function returns a value indicating whether an object is of a given class. Syntax
If Typeof objectVariable Is className Then...
|
|
objectVariable |
The object to be tested |
className |
The class to which the object is to be compared |
Returns
The Typeof function returns -1 if the object is of the specified type, 0 if it is not. Usage
Typeof can be used only in an If statement and cannot be combined with other Boolean operators. That is, Typeof can be used only exactly as shown in the syntax line. To test whether an object does not belong to a class, use the following code structure: If Typeof objectVariable Is className Then [ Perform some action.] Else [ Perform some action.] End If
Related Topics
CreateObject Function GetObject Function Is Operator Me Object New Operator Nothing Function Object Class
|