10-03-2012 02:50 AM
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
10-03-2012 02:55 AM
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.
10-03-2012 03:10 AM
I call sub vi using event case...
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.
10-03-2012 03:21 AM
@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?
10-03-2012 03:43 AM
Attached is the sub vi
10-03-2012 03:49 AM
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.
10-03-2012 04:00 AM
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.
10-03-2012 04:17 AM
thank you for your correction, i'm just learning labview and i dont have basic programming.