LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview function like C# Properties.Settings.Default.Save();

I am using sample code from Labview to save propery settings for a couple of controls (config.llb) and I want to know how to upload these settings when the main VI just open but is not running, similar to C# Properties.Settings.Default.Save();

 

Thanks

 

0 Kudos
Message 1 of 12
(3,203 Views)

Right click the control and select Data Operations>>Make Current Value Default, then save the VI. You can also do this for all the controls and indicators on the FP through the edit menu.


___________________
Try to take over the world!
0 Kudos
Message 2 of 12
(3,191 Views)

Hi tst,

 

Thanks for your comments, however, lets me explain what I am trying to do:

 

As I mentioned above I have saved current control settings using Labview sample code: write configuration settings file.vi

 

but instead of using "read configuration settings file.vi," I wonder if there is a way to upload these settings when main VI just opens but not executing yet (in executable mode).

 

0 Kudos
Message 3 of 12
(3,169 Views)

Just to clarify about my last comment:   I wonder if there is a way to upload these settings when main VI is just loaded into memory, similar to C# as explained in this link: http://msdn.microsoft.com/en-us/library/bb397755.aspx

 

 

0 Kudos
Message 4 of 12
(3,159 Views)

frn wrote:

but instead of using "read configuration settings file.vi," I wonder if there is a way to upload these settings when main VI just opens but not executing yet (in executable mode).


No - your code can't do anything until it starts running, and that includes changing values. In an executable, there is no (easy) way to change the default values. Normally you would set your program to run automatically when it loads, which would then load your configuration, and if you need to allow the user to change settings before it runs, then you would include some sort of Run button in your code instead of using the default LabVIEW one. You would also hide the toolbar so the run arrow isn't even visible.

0 Kudos
Message 5 of 12
(3,158 Views)

Thanks 

0 Kudos
Message 6 of 12
(3,148 Views)

You should never stop your application - the user should never have to push LabVIEW's Run button (again, it shouldn't even be visible to the user). You should structure your code to handle any such needs yourself. You can handle events such as the close (X) button on a window using an Event structure.

0 Kudos
Message 7 of 12
(3,138 Views)

Like Nathan said, you should definitely not require users to stop and run VIs directly. You should alsways do that yourself. If you want to save and load control values, you need code which does this. You can see an example of such code at https://decibel.ni.com/content/docs/DOC-15349 but there are also many others.


___________________
Try to take over the world!
0 Kudos
Message 8 of 12
(3,117 Views)

@frn wrote:

Thanks 


The event structure can capture the Front panel close ("X") and save your settings as it closes.

If you group the front panel as a cluster it's extremely easy to use Read/Write XML to load and save all front panel values on start and exit.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 12
(3,113 Views)

Yamaeda wrote:

"If you group the front panel as a cluster it's extremely easy to use Read/Write XML to load and save all front panel values on start and exit."

 

On above comment "on start," do yu mean when VI is uploaded to memory? or VI needs to run to get front panel updated (same as C# does with Properties.Settings.Default.Save())

 

 

According to nathand:   "No - your code can't do anything until it starts running, and that includes changing values. In an executable, there is no (easy) way to change the default values."

 

Again, what I am trying to do is to update a couple of controls values in executable mode by using the event structure (as you suggested) to capture the Front panel close ("X") and save the settings as it closes.  Then update control settings as VI is loaded into memory, but does not need to run to update values. Again same behaivor as C#: http://msdn.microsoft.com/en-us/library/bb397755.aspx

 

 

0 Kudos
Message 10 of 12
(3,091 Views)