SetPropertyValue( ) method

The SetPropertyValue(  ) method enables you to assign a value to a property even if you do not know the property's name or type at compile time.

Return type: VOID

Access: PUBLIC

Applies to: Progress.Lang.Class class

Syntax

Four overloaded versions are supported. The first version operates on a scalar instance property, where a scalar property is any data type that is not, itself, an array.

class-object-reference:SetPropertyValue ( 
  INPUT object-reference AS Progress.Lang.Object ,
  INPUT property-name AS CHARACTER, INPUT new-value AS any-data-type )

The second version operates on a scalar static property.

class-object-reference:SetPropertyValue ( 
  INPUT property-name AS CHARACTER, INPUT new-value AS any-data-type )

The third version operates on an instance array or .NET indexed property.

class-object-reference:SetPropertyValue ( 
  INPUT object-reference AS Progress.Lang.Object, 
  INPUT property-name AS CHARACTER, INPUT index AS any-data-type, 
  INPUT new-value AS any-data-type )

The fourth version operates on a static array or .NET indexed property.

class-object-reference:SetPropertyValue ( 
  INPUT property-name AS CHARACTER, INPUT index AS any-data-type, 
  INPUT new-value AS any-data-type )
class-object-reference
Specifies a reference to an instance of Progress.Lang.Class for a type that exposes the property. For instance properties, object-reference and class-object-reference must be the same type, or one must inherit from the other. Both must either define the property or inherit it.
object-reference
Specifies a reference to an ABL or .NET class instance that exposes the specified property as an instance member. The compiler allows object-reference to be declared as any object type. At run time, the object type must resolve to the type that exposes the property. GetPropertyValue( ) and SetPropertyValue( ) work correctly even if the object-reference is not known. Alternatively, use the overloaded methods for static property.
Note: The overloads of SetPropertyValue( ) that take an object reference can be used with a static property by setting object-reference to the Unknown value (?). Alternatively, use the overloads that are designed specifically for static properties.
Note: A run-time error arises if object-reference does not inherit from class-object-reference, or vice-versa.
property-name
Specifies a CHARACTER name of the property. The AVM evaluates property-name at run time.
new-value
Specifies the value that is assigned to the property. The value is converted at run time to the property's data type using the appropriate data type casting.
index
Specifies an integer expression for the index of the specified element of an ABL array property. If the property is a .NET indexed property, index is an expression for the specified element. The index for an indexed property does not have to be an integer.
any-data-type
Specifies the data type of the associated element. The set of possible data types depends on the element. For example, the index of an ABL array element can only be an integer type. However, the setting of a property, or array property element, value can be any ABL primitive data or object type.

See also

DYNAMIC-PROPERTY statement, GetPropertyValue( ) method