PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing VI reference using .Net

I've used GetVIReference() method for getting the VI reference and now i want to remove this VI from memory without closing the LabVIEW application. There is no closeVIReference() method and CloseFrontPanel() doesn't work.
0 Kudos
Message 1 of 12
(4,199 Views)

Hello!

I suspect this question might be better suited for either the CVI or LabVIEW board.  I think you are either using ActiveX from a .NET environment to automate LabVIEW.  If so, could you provide some additional information on what you are trying to accomplish?  I suspect that you are attempting to run a VI using automation and close the VI afterwards, but would like to keep LabVIEW open so subsequent calls to run the VI will take less time to load.  If this is the case, you should open a reference to the _Application class, once this is open you can use the methods mentioned above (open VI reference, etc...) and finally use the _Application method "Close" to close LabVIEW.  I'm not exactly sure why your close front panel method is not working, but perhaps if you provide a snippet of the code in the LabVIEW board myself or someone else in the LabVIEW community can take a look at it and see what exactly is going on. 

Hopefully this helps!  Please let me know if you have any additional questions.

Travis M
LabVIEW R&D
National Instruments
Message 2 of 12
(4,184 Views)
Yes i've exectly the same problem. I open the VI using GetVIReference(). Now i want to close the VI without closing LabVIEW application. But the problem is closing the VI frontpanel doesn't remove it from the memory. If the VI is present in memory and i try to open other VI using GetVIReference(), which has the same name, but from a different location, what it does is - it opens the VI that is already in memory. In such a case i've to close the labVIEW application and reopen it and that i dont want to do.
Could u suggest something for this.
0 Kudos
Message 3 of 12
(4,182 Views)
To prevent the VI that was initially loaded into memory from opening when you call the second VI of the same name, make sure that you have closed the reference to that first VI after you have closed the Front Panel.  That will ensure that you cannot use the VI Reference to open another VI.  I was able to open a reference to _Application, then get a VI reference for a VI, open and close that VIs front panel, close the reference, then using the original Application reference get another VI reference to a VI that has the same name, but saved in a different location, and then show its front panel.  To make a long story (or sentence in my case) short close the references down since just closing the front panel will not remove it from memory.

Hope this helps!
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 4 of 12
(4,163 Views)
Hi
I Plesae tell me the function to use for closing the VI reference using C#.net....
0 Kudos
Message 5 of 12
(4,158 Views)
Hi
I know Plesae tell me the function to use for closing the VI reference using C#.net....
0 Kudos
Message 6 of 12
(4,158 Views)
Is there any particular reason why you have not renamed your VI?  That would be the easiest solution.  If you are unable have you tried to "dispose" the reference.  This should destroy the VI reference and allow you to call another VI.

Hope this helps!
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 7 of 12
(4,142 Views)
Yes i tried setting the vi reference object to null but it didn't work.....
 
0 Kudos
Message 8 of 12
(4,091 Views)
Instead of setting it to null you should try the dispose method.  If your reference was named VIReference then you would want to enter the following:

VIReference.dispose()

Let me know if this works!
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 9 of 12
(4,070 Views)
Sorry but i didnt find any method dispose()......
I am using
oVI = oLabViewApp.GetVIReference( cfg.VIFilePath, "",false, 0 ) ;
and there is no method like.... OVI.dispose()
0 Kudos
Message 10 of 12
(4,064 Views)