You can configure a shared variable programmatically by using the SharedVariableIO properties which you can configure for network-published shared variables only.

Enable network publishing for a shared variable before you configure this shared variable.

Complete the following steps to configure a shared variable programmatically:

  1. Create and deploy a shared variable.
  2. Add a shared variable constant on the block diagram. 
  3. Click the down arrow on the shared variable constant and select or browse to a shared variable to configure.
  4. Right-click the shared variable constant and select Create»Property from the shortcut menu.
  5. Select the property you want to configure.
    A Property Node appears with the property you selected.
    Note To write data to the shared variable properties, right-click the Property Node and select Change To Write from the shortcut menu. To read data from shared variable properties, right-click the Property Node and select Change To Read from the shortcut menu. Some properties are read-only properties. Refer to the characteristics of each property to determine whether the property is read-only.
  6. Wire the shared variable constant to the Property Node.