You will need to open a reference to your target VI from another VI. Then you need to use Property Nodes to open a reference to the target VI’s Front Panel and subsequently, the Controls/Indicators on the Front Panel.
Open your main VI and follow these steps:
- Open a reference to the target VI by passing the target VI’s path to the Open VI Reference VI.
- Create a new VI Class Property Node that opens a reference to the front panel.
- Wire the front panel reference into a new Property Node and use this node to open an array of references to the controls/indicators on the front panel.
- Wire the array of references to a for loop.
- You use this for loop to index the controls/indicators on the target VI and case them based on their individual labels.
- Since the value of a control/indicator takes a variant type, use a To More Specific Class VI to specify what type the control/indicator you would like to write to actually is (e.g., integer, string, waveform).
- In the case for the control/indicator you would like to write to, you can use a Property Node to write to the Value property of the specified control/indicator.
- Make the value you just wrote the default value by passing the target VI’s reference through a Default Value: Make Current Value Default Invoke Node.
- Save the target VI by passing the target VI’s reference through a Save Instrument Invoke Node.
- Close reference and catch any errors.
Additional Information
- Note: This method can't be used to set the default values within the same VI. This is because the Invoke Method: Default Values: Make Current Default is not settable when the VI is running.
- Note: Save Instrument Invoke Node is not available with the Runtime Engine (i.e., if you run this VI as an executable or a .dll on a system that does not have the development environment installed). This is documented in the LabVIEW help.