PropertyObject.SetValVariant
- Updated2024-10-09
- 1 minute(s) read
PropertyObject.SetValVariant
Syntax
PropertyObject.SetValVariant( lookupString, options, newValue)
Purpose
Sets the value of the property the lookupString parameter specifies with a variant.
Remarks
You can use this method to set the value of an entire array at once. When you set an array property using this method, TestStand resizes and redefines the dimensions of the destination array to match the array you pass in. Refer to the example in this topic for more information about how to use this method.
Parameters
lookupString As String
[In] Pass an empty string to denote the PropertyObject to which the method applies, or pass the name of a subproperty within the PropertyObject. You can also pass lookup strings to this parameter.
options As Long
[In] Pass 0 to specify the default behavior, or pass one or more PropertyOptions constants. Use the bitwise-OR operator to specify multiple options.
newValue As Variant
[In] Specifies the new value for the property.
Example
LabWindows/CVI: VARIANT tmpVariant; double numArray[] = {0.123, 1.234, 12.34}; CA_VariantSet1DArray (&tmpVariant, CAVT_DOUBLE, 3, numArray); TS_PropertySetValVariant(propObj, &errorInfo, "Locals.NumArray", 0, tmpVariant); CA_VariantClear(tmpVariant); Visual Basic (function call): Dim numArray(2) As Double numArray(0) = 0.123 numArray(1) = 1.234 numArray(2) = 12.34 propObj.SetValVariant("Locals.NumArray", 0, numArray) Visual Basic (inline): Dim numArray(2) As Double numArray(0) = 0.123 numArray(1) = 1.234 numArray(2) = 12.34 propObj.Locals.NumArray = numArray Visual C++: #include "tsvcutil.h" std::vector<double> doubleVector; TSUTIL::SafeArray<double, VT_R8> safeArray; safeArray.SetFromVector(doubleVector); propObj->SetValVariant("Locals.NumArray", 0, safeArray.GetVariant());
See Also
PropertyObject.SetValInteger64
PropertyObject.SetValUnsignedInteger64
PropertyObject.SetValVariantByOffset
Thread Safety of the PropertyObject API and TestStand Variables