LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close existing VI and open another VI simultaneously

Solved!
Go to solution

You can get significantly better help if you would actually attach a set of simplified VIs that show the problem. There are way too many variables that are not visible in a truncated image.

 

0 Kudos
Message 11 of 22
(1,695 Views)

I attached simplified VIs.
Currently the problem is when I open the main VI, then pressing the subvi1 button, then press "return to main menu", it works the first time. The second time, it closes everything (not opening the subvi1)
The other buttons don't work,they are just there because they are in my original program too.

Download All
0 Kudos
Message 12 of 22
(1,689 Views)

(It typically helps to name Vis a bit more uniquely. I have many VIs called subvi.vi in my downloads folder, so the browser renamed it to subvi(3).vi, no longer correctly found by the main vi.)

 

Why is the main VI reentrant?

0 Kudos
Message 13 of 22
(1,680 Views)

Because I also call the main vi from a sub vi, then I get an error: "You cannot make a recursive call in a non-reentrant VI. That is, a non-reentrant VI cannot call itself as a subVI. "

Sorry about the naming, didn't think about it.

0 Kudos
Message 14 of 22
(1,678 Views)

Well, untangle that convoluted mess and just hide the main Vi instead of closing it. Use asynchronous calls and notify the main VI whenever subVIs complete so it can unhide itself.

 

0 Kudos
Message 15 of 22
(1,673 Views)
Solution
Accepted by topic author BG1995

See if this can give you some ideas...

 

altenbach_0-1586635546244.png

 

NOTE: make sure the subVI is closed before running the main VI!

 

 

0 Kudos
Message 16 of 22
(1,665 Views)

I tried hiding the main front panel and using Asynchronous Call as one of the first comments in this post suggested. I get an error that I don't know how to solve "(Hex 0x412) attempted recursive calling back the main VI from the subVI.
I attached the picture from the subVI of execution of the Asynchronous Call, maybe I did it wrong?
subvi calling mainVI.jpg
Thank you and everyone who is helping me so far!

0 Kudos
Message 17 of 22
(1,664 Views)

Look at my example above instead.

0 Kudos
Message 18 of 22
(1,661 Views)

Hmmm, this is sounding stranger and stranger.

 

What are you really trying to do?  Don't talk in terms of "open thie VI, close that VI", talk in terms of what you want the User to think is happening.  Are you trying to program a "Pop-up", what I've seen called a "Modal Dialog Box", something that "pops up, maybe asks a Question, maybe has a "Fill in the Blank" and some buttons ("OK", or "Yes" and "No"), and when the User fills in the blanks and pushes the right button, it "goes away" and hands the results to the underlying calling routine?  [I'm thinking along these lines because I just wrote a few of these ...].

 

Bob Schor

0 Kudos
Message 19 of 22
(1,659 Views)

Problem solved!
Thank you and everyone who have helped me so far!!!!

0 Kudos
Message 20 of 22
(1,647 Views)