Share via


COMVariant.currency Method

Definition

Overloads

currency()

Gets or sets the value of a COMVariant object of the VT_CY data type.

currency(Decimal)

currency()

Gets or sets the value of a COMVariant object of the VT_CY data type.

public:
 virtual System::Decimal currency();
public virtual decimal currency ();
abstract member currency : unit -> decimal
override this.currency : unit -> decimal
Public Overridable Function currency () As Decimal

Returns

The current value.

Remarks

If you pass in a value that has a different data type than the object, the data type of the object will be changed to match the data type of the value. A COMVariant object has a currency data type if its data type is set to COMVariantType::VT_CY. The currency data type is a COM data type that is optimized for currency values. It is a real number with four decimal places. Sometimes "CY" is also used to refer to the COM currency data type.

The following example creates a new COMVariant object of type VT_CY and sets the value to 123.4567.

{ 
    COMVariant var = new COMVariant( 
        COMVariantInOut::IN_OUT,  
        COMVariantType::VT_CY); 
    // Set value of the object 
    var.currency(123.4567); 
}

Applies to

currency(Decimal)

public:
 virtual System::Decimal currency(System::Decimal _newValue);
public virtual decimal currency (decimal _newValue);
abstract member currency : decimal -> decimal
override this.currency : decimal -> decimal
Public Overridable Function currency (_newValue As Decimal) As Decimal

Parameters

_newValue
Decimal

The new value; optional.

Returns

Applies to