Microsoft SDK for Java

setVariant

The setVariant method of the SafeArray Class contains the following signatures:

setString(int idx, String val)
setString(int idx1, int idx2, String val)

setVariant(int idx, Variant val)

Sets an element of a one-dimensional SafeArray.

Syntax

public void setVariant(int idx, Variant val);

Note   Although Variant methods can operate on any SafeArray type, it is usually much more efficient to use the specific method for the element type. This is true even if the SafeArray is a SafeArray of Variants.

Parameters

idx The element index, which ranges from the index of the lower bound to the index of the upper bound.
val The new element value.

Exceptions

IndexOutOfBoundsException if the array is not one-dimensional or if idx does not lie between the lower bound and the upper bound of the SafeArray (inclusive).

ClassCastException if the Java value cannot be converted to the SafeArray element type by using the Win32 VariantChangeType function.

setVariant(int idx1, int idx2, Variant val)

Sets an element of a two-dimensional SafeArray.

Syntax

public void setVariant(int idx1, int idx2, Variant val);

Note   Although Variantjsdk_ref_com_Variant methods can operate on any SafeArray type, it is usually much more efficient to use the specific method for the element type. This is true even if the SafeArray is a SafeArray of Variants.

Parameters

idx1 The first element index, which ranges from LBound(1) to UBound(1).
idx2 The first element index, which ranges from LBound(2) to UBound(2).
val The new element value.

Exceptions

IndexOutOfBoundsException if the array is not two-dimensional or if either index lies outside the defined range.

ClassCastException if the Java value cannot be converted to the SafeArray element type by using the Win32 VariantChangeType function.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.