LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

main vi freeze after close sub vi

Dear all,

 

I call a sub vi from my main vi but when i close sub vi, the main vi become freeze. The sub vi is a vi i used to edit a data from my database, its close after execute a query. Freeze also happen if i close the sub vi with [x] in the corner window

0 Kudos
Message 1 of 8
(3,393 Views)

You don't provide sufficient information to troubleshoot the issue.

 

How do you call the subVI? Does the main VI rely on the subVI to complete before it can proceed? Closing the subVI will simply close the panel, it might not stop the VI or return control to the main VI if it continues running in the background.

 

We need to see some code.

0 Kudos
Message 2 of 8
(3,391 Views)

I call sub vi using event case...

Untitled-1.jpg

and here is my sub vi, when i click edit, a message displayed (diplay message to user) and after i choose yes it will execute the query and then close the sub vi and back to main vi. but my main vi freeze after the sub vi close.

Untitled-2.jpg

0 Kudos
Message 3 of 8
(3,384 Views)

@ijan wrote:

and here is my sub vi, when i click edit, a message displayed (diplay message to user) and after i choose yes it will execute the query and then close the sub vi and back to main vi. but my main vi freeze after the sub vi close.


 

 

THis is NOT your subVI! This is just a partial image of the subVI panel and it does not show sufficient information. It would be much easier for us if you could attach the actual VI. Is there a while loop?

 

In any case, your subVI is probably not completing, you are only closing its panel. The subVI code needs to actually complete! Do you stop the subVI with code that we cannot see?

 

0 Kudos
Message 4 of 8
(3,379 Views)

 

Attached is the sub vi

0 Kudos
Message 5 of 8
(3,372 Views)

You should not close the sub vi using the Window close button because you haven't handled that so your sub vi keeps on running and thus the main vi seems freezed. You have two options to avoid this.

 

  • Disable the window close button and use only the Close button that you have provided in the front panel
  • Capture the Window close button event to stop the code
-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 8
(3,368 Views)

Well, does it work if the [close] button is pressed on the front panel? Unfortunately, by closing the panel after an edit operation, you prevent access to that button and the subVI does not return.

 

All you need to do is remove that entire "close" related inner sequence and instead wire a TRUE to the termination condition of the while loop. Since your subVI is set to open the front panel when called and close afterwards, it will automatically close the VI when the loop (and thus the subVI!) completes. (make sure the subVI is closed before starting the main program!)

You can delete the timeout event since it is not used, but you should add a "panel close?" event to capture pressing of the X. Also complete the subVI loop under this condition.

 

Why are you doing everything with value property nodes? You should wire directly to the terminal instead. There are also potential race conditions.

0 Kudos
Message 7 of 8
(3,364 Views)

thank you for your correction, i'm just learning labview and i dont have basic programming.

0 Kudos
Message 8 of 8
(3,358 Views)