How Do I Load the Same VI into More Than One Subpanel of the Same Front Panel?

Updated Apr 3, 2023

Reported In

Software

  • LabVIEW Full

Issue Details

I would like to load the same VI into two or more subpanels on the same front panel, but I am seeing

Error 1145 occured at Invoke Node in Main VI.vi. Possible reason(s): LabVIEW: Cannot open VI because it is already in a subpanel control.

Is there any way to accomplish this in LabVIEW? I would prefer not to just make a copy of the VI every time I need to load it into more than one subpanel.

Solution

To get around this behavior in LabVIEW, it is possible to load a single VI into more than one subpanel if that VI is saved as a VI Template. A VI Template, as explained inĀ Differences Between Reentrant, Template, and Dynamic VIs , is a VI that is designated as a starting point for developing other VIs. When opened, the VI Template itself is not opened, but rather a new and separate VI is created and loaded into memory. This behavior is useful in this scenario because when each Insert VI method node is given a separate reference to the same VI template, each will load a new and separate instance of the VI in its respective subpanel.

To avoid Error 1145, it is also necessary to create two separate dynamic VI references using the Open VI Reference function in LabVIEW. This will keep LabVIEW from seeing the VI as the same VI due to the two of them having the same VI Server refnum.

For an example of how this solution might be accomplished, please see the NI Community example entitled Load Two Sub Panels with Same VI Using VI Template (*.vit) .