Search code examples
windows-desktop-gadgets

Store a variable locally


Is there a way i can store a number locally?

I want to make a counter, so each time the user clicks the button the number is increased. But i would like it to be stored so i could reboot my computer and when its loaded it displays the last number.


Solution

  • I would refer to this website: http://dotnetslackers.com/articles/net/SettingsManagerforWindowsVistaSidebarGadgets.aspx

    You can either download and implement that, though it's a bit bulky for your desired functionality. Alternatively, you can download it and see how the SettingsManager.js file creates an .ini file and then later reads from it (which you could then use to make an .ini file holding an integer, which you would read every time you wanted load the value and save every time the value changed).