From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reference a subVI in Application (c.f Development mode)?

Solved!
Go to solution

Am trying to create a pop up screen from my Main VI. So I need to reference to it using VI server from the Main and also close the SubVI when the user choses to close it.

 

In development mode I can use: current VI's path for the subVI or I can use current VI's path for the main and then build/strip path to get the subvi or I can use Application Directory.

 

Question is how will this be done when the application is built--- as in the application the path of the subvi does not exist anymore? Is it automatically located?

0 Kudos
Message 1 of 7
(2,312 Views)

hello,

 

the exe will start the main vi as startup vi. if you had mentioned in startup vi while building.

Depends on how you build exe

 

Bharath

Thanks & Regards,
Bharath Kumar
GCentral
0 Kudos
Message 2 of 7
(2,296 Views)

Hi rajiv,

 

In development mode I can use: current VI's path for the subVI or I can use current VI's path for the main and then build/strip path to get the subvi or I can use Application Directory.

You can also use a static VI reference…

 

Question is how will this be done when the application is built--- as in the application the path of the subvi does not exist anymore? Is it automatically located?

The path of the subVI typically stays the same inside the executable (since LV8 or so)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 7
(2,284 Views)

@GerdW wrote:

...

You can also use a static VI reference

...

 

That is my preferred method unless dynamic instanciation is required.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 7
(2,276 Views)
Solution
Accepted by topic author rajiv85

I do this using a sub-Panel in the Main VI.  When I want to run (and see the Front Panel of) a sub-VI, I use a Static VI Reference to the sub-VI and wire it to an Insert VI Method for the sub-Panel.  This not only starts the sub-VI running as a parallel asynchronous loop, it also provides access to controls and indicators on its Front Panel which act in the context of the sub-VI.

 

The same code works both in Development Mode and when built into an Executable (the Static VI Reference works wonders in this way).

 

Bob Schor

Message 5 of 7
(2,215 Views)

Piling it on...

 Another bonus of the static reference is that it includes the target VI in the hierarchy of the caller. This means no surprises when we try to invoke the VI and find out it was broken since it was not open and some code change broke it.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 7
(2,210 Views)

Thank you all for the responses!! Smiley HappySmiley Wink

0 Kudos
Message 7 of 7
(2,174 Views)