To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example shows how to load VIs into a subpanel control, and display them on the front panel of a host VI.
Description
This example shows how to load VIs into a subpanel control, and display them on the front panel of a host VI.
In the block diagram, change the inputs inside both cases of the case structure to reflect the location of VIs on your PC. Run the program and toggle between the front panels of the 2 VIs by toggling the "Change subVI" button.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
hai i am trying to load multiple sub vi on each call to a subpanel , the problem i am facing is once executed subvi in a subpanel is not executing on the second call. please give some suggestions.
Some things to watch out for when using this pattern in the real world:
In this example there is no restricition on the number of times the Insert VI function runs while the loop is executing, nor is there any delay in the loop. Thus the chosen panel will be inserted into the subpanel control as fast and as many times as your computer will allow. Remember to design your loop properly so this does not happen.
Also, another way to do this would be to open the VI references outside the while loop, and wire them through to the case structure. This way the loading is done only once when the main VI is run, and not repeatedly. Granted, if you need the VI reference to be chosen dynamically this method will not work.
Finally, I believe it is good practice to close your VI references after you are done with them. The example relies on LabVIEW to automatically close the references, but a good habit is to close your own references since ActiveX and .NET refnums are not handled automatically at all.