ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
04-21-2025 03:18 PM
OK, here's the situation:
I tried the ProjectItem methods "AddItem" and "AddFile" and "AddItemFromMemory", but those failed because the Item already exists in the class library.
Anyone out there done this before and can point the way?
Solved! Go to Solution.
04-21-2025 03:32 PM
There is a "ProjectItem" method called "Move", but it's hidden by default:
You can make this (and a LOT of other stuff, most of which you won't need) visible by changing your LabVIEW.ini file to include this line:
SuperSecretPrivateSpecialStuff=True
Alternately, to add it without changing your INI file:
1. Drop an invoke node for the ProjectItem class on one of the other methods (any).
2. Make sure it and nothing else is selected on the block diagram.
3. Press control-space to bring up Quick Drop
4. Wait for a bit if this is the first time you have opened it
5. Type in "Move"
6. Press Control-Shift-B
It should then alter that invoke node to be a "Move" method.
04-21-2025 03:38 PM
Hi,
Sure, there is the private ProjectItem method "Move":
To be able to select it, add this key to your LabVIEW.ini and restart LabVIEW:
SuperSecretPrivateSpecialStuff=True
As long as the move does not provoke a namespace change, this should be sufficient.
If it does (by moving the vi in or out of a library, or from one library to another), things can get more complicated because manual dialogs asking to save callers may appear. Here are the details of a workaround I had found:
https://forums.ni.com/t5/LabVIEW/Programmatically-move-project-item-without-dialog/m-p/4375174
Regards,
Raphaël.
04-22-2025 03:18 PM
Thanks!
Any chance you have a tricksy way of converting from a VI refnum to a ProjectItem refnum?
What I did was close the VI, then traverse the Project to get the class, then look inside the class to get the Method. Seems kinda like there should be an easier way...
-- Rob
04-23-2025 04:31 AM
@10Things_Rob wrote:Any chance you have a tricksy way of converting from a VI refnum to a ProjectItem refnum?
04-14-2026 06:25 PM
I banged my head against this problem FAR too long today... my Google Fu was weak. I was trying to move a VI into a property definition folder, so I didn't see this thread until I mostly had it, but it was still the last key I needed!
Just wanted to add that you can also get the ProjectItem for a VI without using the Project with this method:
(It's very obnoxious that there isn't a public way to put an already-created VI that already belongs to a class into a property definition folder or virtual folder 😓)