COMVariant::createFromStr Method [AX 2012]

Creates a new COMVariant object and initializes it with a string in one operation.

client server public static COMVariant createFromStr(str value, [COMVariantInOut inOutFlag])

Run On

Called

Parameters

value
Type: str
The integer value that is used to initialize the object.
inOutFlag
Type: COMVariantInOut Enumeration
A flag that determines whether the object can be used to pass data to a COM method or COM property, to receive data, or both. This parameter is optional.
Possible values are:

Return Value

Type: COMVariant Class
The new COMVariant object.

The COMVariant object that is created by this method has the data type VT_BSTR (string).

You can change the data type of an existing COMVariant object to VT_BSTR by using the variantType method or by passing in a string value by using the bStr property method.

The following example creates a COMVariant object of the VT_BSTR variant data type and sets the value to "Hello World."

{ 
    COMVariant var; 
   
    var = COMVariant::createFromStr("Hello World"); 
}
Show: