LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically make values default

hei
i know it has been treated 100 times already in the forum.
but i just cant get it to work
here how i do it:
non-strict refnum (actually not like in the pic) - bring to edit mode using property - make values default - save
 
 
remark i dont connect the error node from the first method call, because i want it to work even if the vi was not openned in this vi.
 
but it doesnt work! keep erroring me all the time...

Message Edited by Gabi1 on 05-13-2007 09:44 AM

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 1 of 8
(3,389 Views)
You would make our life easier if you would attach your VI instead of an image, and also mention what the error message says. 😉
0 Kudos
Message 2 of 8
(3,377 Views)
One potential problem is that the routine making the default value change must be the only VI that is loading the target VI into memory. The need for the abort method is a huge red flag. If this logic is necessary, the target must obviously be loaded into memory elsewhere and either executing or in a reserved for execution state - either of which would preclude saving the front panel defaults.

Make sure the target VI is not in memory and use the Open VI Reference function to get a reference to the VI (you will need to provide a complete path to the target VI). This function loads the VI into memory and returns a reference to it. Do this and the rest of your code should work.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 8
(3,357 Views)
The VI can be in memory, and even in other VI's diagrams. As long as the VI is not running, you can dynamically set values to default.


Regards,


Wiebe.
0 Kudos
Message 4 of 8
(3,331 Views)
The VI can be in memory, and even in other VI's diagrams. As long as the VI is not running, you can dynamically set values to default.


When you use a static VI reference, the VI is set to run mode. So you need to open a reference to it with the Open VI Reference function.


Regards,


Wiebe.
0 Kudos
Message 5 of 8
(3,331 Views)
The VI can be in memory, and even in other VI's diagrams. As long as the VI is not running, you can dynamically set values to default.


When you use a static VI reference, the VI is set to run mode. So you need to open a reference to it with the Open VI Reference function.


Keep in mind that the Save Instrument method will probably not work when you build an executable.


Regards,


Wiebe.
Message 6 of 8
(3,331 Views)
Sorry about sending it three times... Outlook behaved a bit stange...
0 Kudos
Message 7 of 8
(3,332 Views)

ok guys,

got it to work using the open vi reference also to call the front panel.

thanks for the tip!

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 8 of 8
(3,291 Views)