Partilhar via


COMVariant.uShort Method

Definition

Overloads

uShort()

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

uShort(Int32)

uShort()

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

public:
 virtual int uShort();
public virtual int uShort ();
abstract member uShort : unit -> int
override this.uShort : unit -> int
Public Overridable Function uShort () As Integer

Returns

The current 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 an unsigned short data type if its data type is set to COMVariantType::VT_UI2.

The following example creates a new COMVariant object of type VT_UI2 and sets the value to 12345.

{ 
    COMVariant var = new COMVariant( 
        COMVariantInOut::IN_OUT,  
        COMVariantType::VT_UI2); 
    // Set value of the object 
    var.uShort(12345); 
}

Applies to

uShort(Int32)

public:
 virtual int uShort(int _newValue);
public virtual int uShort (int _newValue);
abstract member uShort : int -> int
override this.uShort : int -> int
Public Overridable Function uShort (_newValue As Integer) As Integer

Parameters

_newValue
Int32

The new value; optional.

Returns

Applies to