LabVIEW Project Providers

Showing results for 
Search instead for 
Did you mean: 

'Add Item From Memory' Issue


I am trying to add an Item to the Project via Item_OnCommand using the AddItemFromMemory method on a Class I create (using LVClass.Create method).

The code works fine when running 'normally in LabVIEW' however, when this code is called through the Provider I get an Error:

Error 1004 occurred at an unidentified location

Possible reason(s):

LabVIEW:  The VI is not in memory.

If I save the newly created Class to disk then use the AddFile method, then it works.

The Error is generated immediately after the AddItemFromMemory method is called.


I maybe doing something wrong but I am thinking this may have something to do with the Context?

Can anyone offer advice?



Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 1 of 4

Hey Jonathon,

I definitely think it is a context issue like you mentioned.  Since you are creating your LVClass with no reference wired, it is created in whatever context the VI is running in, which in the case of the provider VI is the NI.LV.MxLvProvider context.  The AddItemFromMemory method is running in the context of the Item, which I assume is the My Computer context in the project.  The trick to get around this is to explicitly create the LVClass in the same context as the Item input.  To do this all you need to do is get the Application Reference from the Item input and wire that to your method node up top. 

Get App Reference.png

Hopefully this SHOULD work, but let me know if not and I'll try to think of some other ideas. 


Message 2 of 4

I swear I was playing around with the App instance last night and I was still getting an error.

Oh well, its working now - thanks!

Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 3 of 4

No problem.  I understand how that is.  I have to take my car in this week for a check engine light, and I assure you that the light will go off as soon as I drive into the parking lot of the dealership...

Good luck, and happy LabVIEWing!

Message 4 of 4