LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Object is not Valid Error

Hi,
I am facing a problem in GetdatatoModify.vi.I am calling
GetdatatoModify.vi in one of my application called write.vi.Once this
is called from my frontend application ,it is showing error that
"ERROR1 object say xxxxx is not valid".This object actually I am
getting from referance from create.vi.I verified referance getting from
create.vi and referance passed to GetdatatoModify.vi are same.
The interesting thing is if I have opened my write.vi in
background,everything will work properly.Then no object invalid problem
comes.
Pls help me on the same

Thanks,
Anurag

0 Kudos
Message 1 of 4
(3,214 Views)
What exactly is this "GetdatatoModify.vi"? Is it a VI you wrote or got somewhere? Posting your VI would help. Your best bet would be to do a Save As and select Development Distribution so that you create an llb with the main and subVIs.
Message 2 of 4
(3,206 Views)


@keithely wrote:
Hi,
I am facing a problem in GetdatatoModify.vi.I am calling
GetdatatoModify.vi in one of my application called write.vi.Once this
is called from my frontend application ,it is showing error that
"ERROR1 object say xxxxx is not valid".This object actually I am
getting from referance from create.vi.I verified referance getting from
create.vi and referance passed to GetdatatoModify.vi are same.
The interesting thing is if I have opened my write.vi in
background,everything will work properly.Then no object invalid problem
comes.


I have no idea what VI you are refering to with GetdatatoModify.vi but I have a good guess what is your problem. LabVIEW deallocates objects automatically when the top level VI in whose hierarchy the object was created goes idle (ceases to run). What you are probably doing is opening the object reference in one VI writing it to a global and then doing a Read or write on that object reference from another VI. This will not work. You have to keep the VI that created the object alive somehow for the entire duration of your application.
Yet even better is to use dataflow dependancy (thus wiring the refnums from the create function to the actual read or write function and structure your program such that this can be done nicely) and forget about globals for this purpose altogether. Globals are the poor mans solution for those that can not be bothered to sit down and think about a design before starting to actually code according to that design sketched out beforehand.

Rolf Kalbermatter

Message Edited by rolfk on 04-12-2006 04:18 PM

Rolf Kalbermatter
My Blog
Message 3 of 4
(3,202 Views)
He's probably using one of the OO toolkits, like the one from NI, or GOOP. They have VIs with names like "GetDataToModify".

Message 4 of 4
(3,195 Views)