Share via


COMVariant.float Method

Definition

Overloads

float()

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

float(Decimal)

float()

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

public:
 virtual System::Decimal float();
public virtual decimal float ();
abstract member float : unit -> decimal
override this.float : unit -> decimal
Public Overridable Function float () 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 float type if its data type is set to COMVariantType::VT_R4. Sometimes "single" is also used to refer to the COM float data type.

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

{ 
    COMVariant var = new COMVariant( 
        COMVariantInOut::IN_OUT,  
        COMVariantType::VT_R4); 
    // Set value of the object 
    var.float(123.456); 
}

Applies to

float(Decimal)

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

Parameters

_newValue
Decimal

The new value; optional.

Returns

Applies to