Showing results for 
Search instead for 
Did you mean: 

Run VI in labview.

Go to solution

I need to load a display window continuously.

In development environment, the display window was not closed by FP.close method and stop the monitoring of while-loop.

(Maybe, application mode is not a problem.)

Therefore, I can meet the famous message,"LabVIEW: (Hex 0x3E8) The VI is not in a state compatible with this operation."


How can I close the display window in development environment (under LabVIEW)?




Download All
0 Kudos
Message 1 of 7

It seems the error happen when you run the subvi twice, try to "abort vi "before close reference.Screenshot 2022-11-15 173948.png

0 Kudos
Message 2 of 7
Accepted by topic author labmaster

Hi labmaster,

you can achieve the same result using state machine instead of your current approach.

your subvi is not stopped immediately after you set the exit control value to 'true' (300ms delay you added), and the main loop is trying to run the subvi  which is already in run state hence throwing error, add a little delay after you close the reference or set a Boolean indicator to true after while loop finishes execution and read this control value to get the completion state of subvi.

0 Kudos
Message 3 of 7
Accepted by topic author labmaster

You are "doing it the hard way" (which, as you've seen, doesn't work very well).  What you want to do is to run your sub-VI ("Display Clock") in a sub-panel of your main VI.  A sub-panel is an area on the main VI's Front Panel where you can "run" a sub-VI, see its Front Panel, interact with its Controls (i.e. push the "Exit" button), etc.


Here's what you do:

  1. On your Main VI's Front Panel, drop a sub-panel (in the Layout palette) where you want your sub-VI's Front Panel to appear.  Make it an appropriate size.
  2. On the Block Diagram, you should see a new item that looks like an Invoke Node with the name "Sub Panel", and a setting "Insert VI", asking for a VI Ref.
  3. Right-click the Block Diagram, go to Application Control, and drop "Static VI Reference".  Wire this to the VI Ref of the Sub Panel node.
  4. Right-click the Static VI Reference, choose "Browse for Path", and find the path of the VI you want to "run in the sub-panel" (which I assume is "display clock").
  5. In your Main code, put the sub-Panel Node with the VI Reference in the spot when you want to start running the Display Clock.  When you do this, it should start running inside the sub-Panel.  When you push the Exit button inside Display Clock running inside the sub-Panel", Display Clock will stop.
  6. If you want to get rid of the contents of the sub-Panel, make a copy of the Sub Panel "Insert VI" node, and click on "Insert VI", which will expand the options you can put there, including "Remove VI" (which "removes the VI from the sub-Panel).

Give that a try.


Bob Schor

0 Kudos
Message 4 of 7
Accepted by topic author labmaster

@labmaster wrote:

I need to load a display window continuously.

Can you give a more realistic example? This is just glaringly convoluted Rube Goldberg code!

Why do you have an outer FOR loop with 5 iterations that creates new references and opens/closes the same VI over and over (While you say continuously). Then you have an inner FOR loop that updates time every 300ms even though the value only changes once per second. Why can't the subVI calculate time locally instead? Why does the subVI even need to run if you are updating an indicator remotely? (Yes, you can set the same time format for a plain numeric indicator! No need for formatting operations!)


See if the attached can give you some ideas.



0 Kudos
Message 5 of 7
Accepted by topic author labmaster

I can't look at your code, but FP.close doesn't stop a VI, it only closes the front panel. Could that be the issue?

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
0 Kudos
Message 6 of 7

Thank you all.

I fixed the trouble by using exec.state method and terminating the display window surely.


I remember all familiar experts in this forum, so I am very happy with you.



0 Kudos
Message 7 of 7