COMVariant.bStr Method
Gets or sets the value of a COMVariant object of the VT_BSTR data type.
Syntax
public str bStr([str newValue])
Run On
Called
Parameters
- newValue
Type: str
The new value; optional.
Return Value
Type: str
The current string 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 string data type if its data type is set to COMVariantType::VT_BSTR.
The BStr data type is a COM data type that is used for handling strings.
Examples
The following example creates a new COMVariant object of type VT_BSTR, and sets the value to "Hello World."
{
COMVariant var = new COMVariant(
COMVariantInOut::IN_OUT,
COMVariantType::VT_BSTR);
// Set string value of the object
var.bStr("Hello World");
}