RAD Studio VCL Reference
Variants.VarAsType Function

Converts a variant to specified type.

function VarAsType(const V: Variant; AVarType: TVarType): Variant;
Variant VarAsType(const Variant V, TVarType AVarType);

VarAsType converts a variant to a specified type and returns a new System::Variant that has the specified type. 

V is the System::Variant to convert. 

VarType is a variant type code that indicates the type to which V should be converted. This can be one of the constants defined in the System unit, or it can be the type code for a custom variant type. It cannot include the varArray or varByRef bits.  

VarAsType raises an exception if the variant cannot be converted to the given type. This will be EVariantError or one of its descendants, such as EVariantOverflowError or EVariantTypeCastError


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!