DotNetObject.SetProperty

Set the value of a property on an instance

WTSupported in traditional Synergy on Windows

 

 

 

object.SetProperty(propertyname, value)

Arguments

object

An object returned by the DotNetObject constructor, the DotNetAssembly constructor, or some other property or method that returns an object.

propertyname

The name of the property to set.

value

The new value for the property.

Discussion

Propertyname must be a public or public static property defined for the specified object, and a set method must exist for it so that it is not read‑only. Otherwise, an $ERR_MISSMETH error will occur.

If a property is defined more than once using different value types, the default binder is used to attempt to locate the best fit for the parameter passed. If no match is found, an $ERR_MISSMETH error will occur

The value parameter will be converted from a Synergy/DE type to a .NET type using the same rules as for DotNetObject.Call.

If a structfield member is to be set, object will be the value of the structfield returned from DotNetObject.GetProperty or DotNetObject.GetField. Structs are boxed objects (copies), and once the members have been updated with DotNetObject.SetField, the struct must be copied back to the original field or property location with DotNetObject.SetField or DotNetObject.SetProperty using the boxed struct returned from the original DotNetObject.GetField or DotNetObject.GetProperty.

If object is an object returned by the DotNetAssembly constructor, only static properties can be accessed using the namespace.class.property form of propertyname.

Examples

The example below sets the Text property to “button1”. See Sample programs for an example in the context of a complete program.

button.SetProperty("Text", "button1")