AdvancedHMI Software
General Category => Support Questions => Topic started by: MrPike on December 31, 2014, 11:56:52 AM
-
Im using VS2013 for AHMI. Im wondering is there a way to have retentive data when AHMI restarts. For instance if I enter a value into textbox1 then restart AHMI will the previous value still be there? I would not want to re-enter all my data upon restart Is this possible, thanks.
-
Each control has a Property named (ApplicationSettings). You can use this to bind properties to a Setting. The settings are saved on a proper exit and restored at startup.
If you right click your project and select properties, then select the Settings tab, these are where the settings are stored. It is basically a retentative variable that can be linked to object properties usingthe Application Settings for each control.
-
ok I see where i can type in a value into the "VALUE" field and this works when i restart AHMI. i would like to write a new value to this field when I enter a new value in the textbox and press update. Is this possible, can you show me the code, thanks.
-
I did a work around by writing/reading to a .txt file. seems to work fine. thanks
-
So here is how to do it with application settings:
1) Add a TextBox to your form
2) In the Properties window, expand down ApplicationSettings
3) Click in the area of (PropertyBinding) to get the ellipses (3 dots), then click on that to open a dialog window
4) In that dialog window, scroll down to the Text property
5) Click the drop-down for Text and select New, then another dialog window will pop up
6) In the Name property of that dialog window, put any name you wish to call it (referred to as the setting name)
7) Click OK to the 2 dialog windows
8) Run the application
9) Type something in the TextBox
10) Close the application
11) Run the application again
12) You should see the value you put in the TextBox still there
-
what if a user wanted to change this textbox value by typing a new value then click a button to save it? Is there a way to write it to that text binding on say Button_click?
-
In the click event handler:
My.Settings.Save