A very simple application: how to save it?

I have a very simple application (link at Smash).
It basically ha a few radiobuttons. I would like to save the status of those buttons for the next time I open it (and, in case, detect a change to save a new status).
I’m not sure how to do it, any example shows how to save text or, at the most, images, none if you try to save something else.

Thank you

Here’s a blog post @Paul_Lefebvre wrote back in 2014, it should still work, there’s an example link at the bottom to the code:

Saving Preferences – Xojo Programming Blog

In the Example, the Preferences file is saved in … the Application Support folder…

Dim prefFolder As FolderItem = SpecialFolder.ApplicationData.Child(mAppName)

Search in a folder named: “PreferencesExample”, you will find a “Pref” file named “PreferencesExample.pref”.

Nota: you have to explicitely save and load the RadioButtons data; the example does not shows how to do that.

1 Like


I’ve been using a module called XML Preferences by Kevin Ballard for many years, (since 2005). I still have the original .rb file). It requires another module called XML Dictionary also written by Kevin Ballard. It’s incredibly easy to use and will write an .ini file on windows or a ,pref file on Mac OS. I can’t seem to find it for download anywhere any more and his web site www.tildesoft.com is now run by Lilly Ballard who I presume is related to Kevin.

It uses GetPref and SetPref methods to save and retrieve preferences like:

AnIntegerVariable = GetPrefInteger("My_Integer",500) // If My_Integer doesn't exist, loads default 500
SomeStringVariable = GetPrefString("My_String","My String Value") // If My_String doesn't exist, loads default "My String Value"
SomeBooleanVariable = GetPrefBoolean("My_Boolean",False) // If My_Booleandoesn't exist, loads default False

You must call the following method to start using the Get and Set Methods:


Call the following method to save your Preferences (Usually just before your app closes):


Typically I also set the Prefs file names as a constant


I load the prefs on app open from a method App.LoadPrefs and then save prefs if they don’t exist using an App.PrefsSave method as well as saving prefs at application close

Var f As FolderItem
f = SpecialFolder.Preferences.Child(kPreferencesFileName)
If Not f.exists Then
End If

Since it was freely shared when I downloaded this version I suppose there is no reason why I can’t share it with anyone that is interested. There are no restrictions in the module notes. Just PM me if you would like a copy.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.