COMVariant.variantType Method

Definition

Overloads

variantType()

Queries a COMVariant object for its variant data type or changes the data type.

variantType(COMVariantType)

variantType()

Queries a COMVariant object for its variant data type or changes the data type.

public:
 virtual Dynamics::AX::Application::COMVariantType variantType();
public virtual Dynamics.AX.Application.COMVariantType variantType ();
abstract member variantType : unit -> Dynamics.AX.Application.COMVariantType
override this.variantType : unit -> Dynamics.AX.Application.COMVariantType
Public Overridable Function variantType () As COMVariantType

Returns

The current variant data type.

Remarks

The possible values for the newValue parameter are:

  • COMVariantType::VT_I2
  • COMVariantType::VT_I4
  • COMVariantType::VT_R4
  • COMVariantType::VT_R8
  • COMVariantType::VT_CY
  • COMVariantType::VT_DATE
  • COMVariantType::VT_BSTR
  • COMVariantType::VT_DISPATCH
  • COMVariantType::VT_ERROR
  • COMVariantType::VT_BOOL
  • COMVariantType::VT_VARIANT
  • COMVariantType::VT_UNKNOWN
  • COMVariantType::VT_DECIMAL
  • COMVariantType::VT_I1
  • COMVariantType::VT_UI1
  • COMVariantType::VT_UI2
  • COMVariantType::VT_UI4

The variant data type describes how the data that is stored in the object is treated when the object is used as an argument in a call to the COMDispFunction.call method or a call to the COM class. If you change the data type, the data that is held in the object is deleted. See the [COMVariant.new] for information about the available variant data types.

The following example creates a new COMVariant object and sets it to be of long (VT_I4) data type. The variantType method is then used to change the data type to VT_DATE (date). The data that is held by the object is discarded.

{ 
    COMVariant var = new COMVariant(); 
    // Set the 'var' object to be a long 
    var.long(123); 
    // Change var so that it can store a date 
    var.variantType(COMVariantType::VT_DATE); 
}

Applies to

variantType(COMVariantType)

public:
 virtual Dynamics::AX::Application::COMVariantType variantType(Dynamics::AX::Application::COMVariantType _newValue);
public virtual Dynamics.AX.Application.COMVariantType variantType (Dynamics.AX.Application.COMVariantType _newValue);
abstract member variantType : Dynamics.AX.Application.COMVariantType -> Dynamics.AX.Application.COMVariantType
override this.variantType : Dynamics.AX.Application.COMVariantType -> Dynamics.AX.Application.COMVariantType
Public Overridable Function variantType (_newValue As COMVariantType) As COMVariantType

Parameters

_newValue
COMVariantType

The new variant data type; optional.

Returns

Applies to