COMVariant.newmethod Method

Definition

Overloads

newmethod()

Creates a COMVariant object that can be used to pass arguments to the methods or properties of a COM Automation object.

newmethod(COMVariantInOut)
newmethod(COMVariantInOut, COMVariantType)

newmethod()

Creates a COMVariant object that can be used to pass arguments to the methods or properties of a COM Automation object.

protected:
 override void newmethod();
protected override void newmethod ();
override this.newmethod : unit -> unit
Protected Overrides Sub newmethod ()

Remarks

If the type parameter is omitted, no internal memory will be allocated until it is needed by one of the property methods of the COMVariant object. For a list of the property methods, see [COMVariant Class]. You can change the variant data type after it has been set by passing in a new value of a different type (by using one of the property methods). The data types that are defined by the COMVariantType enum are equivalent to the variant data types that are defined by the Win32 SDK.

The following example creates three COMVariant objects:

  • varIn is for passing data to a COM method; it has a string stored in it and then a short (integer).

  • varOut is to receive data of type VT_I4 (long).

  • varOutRetval can pass in or receive data; its data type can be set by the COMDispFunction.call method.

{ 
    COMVariant varIn  = new COMVariant(); 
    COMVariant varOut = new COMVariant( 
        COMVariantInOut::OUT,  
        COMVariantType::VT_I4); 
    COMVariant varOutRetval = new COMVariant( 
        COMVariantInOut::OUT_RETVAL); ; 
    // Store a text string in the varIn object 
    varIn.bStr("Hello World"); 
    // Change varIn to a short. 
    // Text string stored in varIn is automatically released 
    varIn.short(123);  
}

Applies to

newmethod(COMVariantInOut)

public:
 void newmethod(Dynamics::AX::Application::COMVariantInOut out1);
public void newmethod (Dynamics.AX.Application.COMVariantInOut out1);
override this.newmethod : Dynamics.AX.Application.COMVariantInOut -> unit
Public Sub newmethod (out1 As COMVariantInOut)

Parameters

Applies to

newmethod(COMVariantInOut, COMVariantType)

public:
 void newmethod(Dynamics::AX::Application::COMVariantInOut _inOutFlag, Dynamics::AX::Application::COMVariantType _type);
public void newmethod (Dynamics.AX.Application.COMVariantInOut _inOutFlag, Dynamics.AX.Application.COMVariantType _type);
override this.newmethod : Dynamics.AX.Application.COMVariantInOut * Dynamics.AX.Application.COMVariantType -> unit
Public Sub newmethod (_inOutFlag As COMVariantInOut, _type As COMVariantType)

Parameters

_inOutFlag
COMVariantInOut

A type of data to store; optional. These are the possible values that are supplied by the COMVariantType system enum:

_type
COMVariantType

A type of data to store; optional. These are the possible values that are supplied by the COMVariantType system enum:

Applies to