CType Function

Syntax                  CType(expr, objtype)

Group                   Conversion

Description           Convert an expr to the specified objtype type. Conversion include inheritance, implementation and value conversion. If the expr can't be converted, a "type mismatch error" will occur.

Parameter              Description

expr                         Convert the value of this expression.

objtype                    Convert to this type.

See Also               DirectCast, TryCast.

Example               '#Language "WWB.NET"
SubMain
    Debug.Print CType(1.1, Integer) ' 1
    Dim V As Object
    V = Err
    Debug.PrintTypeName(CType(V, ErrObject)) ' ErrObject
EndSub