COMVariant.sCode Method [AX 2012]

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

public int sCode([int newValue])

Run On

Called

Parameters

newValue
Type: int
The new value; optional.

Return Value

Type: int
The current value.

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 an scode data type if its data type is set to COMVariantType::VT_ERROR.

The scode data type is a COM data type that is equivalent to the Win32 HRESULT data type, which is most used as return values for COM functions.

The following example creates a new COMVariant object of type VT_ERROR and sets the value to 0x80001004.

{ 
    COMVariant var = new COMVariant( 
        COMVariantInOut::IN_OUT,  
        COMVariantType::VT_ERROR); 
  
    // Set value of the object 
    var.sCode(0x80001004); 
}

Community Additions

ADD
Show: