Freigeben über


COleCurrency::GetStatus

Call this member function to get the status (validity) of a given COleCurrency object.

CurrencyStatus GetStatus( ) const;

Return Value

Returns the status of this COleCurrency value.

Remarks

The return value is defined by the CurrencyStatus enumerated type that is defined within the COleCurrency class.

enum CurrencyStatus{

valid = 0,

invalid = 1,

null = 2,

};

For a brief description of these status values, see the following list:

  • COleCurrency::valid   Indicates that this COleCurrency object is valid.

  • COleCurrency::invalid   Indicates that this COleCurrency object is invalid; that is, its value may be incorrect.

  • COleCurrency::null   Indicates that this COleCurrency object is null, that is, that no value has been supplied for this object. (This is "null" in the database sense of "having no value," as opposed to the C++ NULL.)

The status of a COleCurrency object is invalid in the following cases:

  • If its value is set from a VARIANT or COleVariant value that could not be converted to a currency value.

  • If this object has experienced an overflow or underflow during an arithmetic assignment operation, for example += or *=.

  • If an invalid value was assigned to this object.

  • If the status of this object was explicitly set to invalid using SetStatus.

For more information on operations that may set the status to invalid, see the following member functions:

Example

// even an empty COleCurrency is valid
COleCurrency cy;
ASSERT(cy.GetStatus() == COleCurrency::valid);

// always valid after being set
cy.SetCurrency(4, 500);
ASSERT(cy.GetStatus() == COleCurrency::valid);

// some conversions aren't possible and will 
// cause an invalid state, like this:
CByteArray array;
COleVariant varBogus(array);
cy = varBogus;
ASSERT(cy.GetStatus() == COleCurrency::invalid);

Requirements

Header: afxdisp.h

See Also

Reference

COleCurrency Class

Hierarchy Chart

COleCurrency::SetStatus

COleCurrency::m_status