Partilhar via


COMVariant.bStr Method

Definition

Overloads

bStr()

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

bStr(String)

bStr()

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

public:
 virtual System::String ^ bStr();
public virtual string bStr ();
abstract member bStr : unit -> string
override this.bStr : unit -> string
Public Overridable Function bStr () As String

Returns

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.

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"); 
}

Applies to

bStr(String)

public:
 virtual System::String ^ bStr(System::String ^ _newValue);
public virtual string bStr (string _newValue);
abstract member bStr : string -> string
override this.bStr : string -> string
Public Overridable Function bStr (_newValue As String) As String

Parameters

_newValue
String

The new value; optional.

Returns

Applies to