Saving TextField

A real Newbie question, I’m sure.

Is there a quick way to save the value of a TextField so it is auto loaded when the app starts again?
I’m not talking about the initial text, but once some text has been entered it gets saved somewhere and the loads that value back in when the app starts the next time.
(It’s a single number - x.xxx)

I cant find a SAVE option for TextField in the release.

Any help appreciated.
Marc

Have a look here. Further down is an example on how to save a text file :slight_smile:
Language reference-FolderItem

Thanks Albin,
Taking a look now.

No problem!
If you get stuck, let us know :slight_smile:

Hi,
I can now save a file and then open the file. Good times.
Is there a way to hide those steps. So it saves and loads without user interaction? Maybe it can save the file to the App somehow?
Thanks again.

my current save code:
Dim t As TextOutputStream
Dim f As FolderItem
f = GetSaveFolderItem("", “stuff.txt”)
If f <> Nil Then
t = TextOutputStream.Create(f)
t.WriteLine(TextField1.Text)
t.Close
End If

and current open code:
Dim f As FolderItem = GetOpenFolderItem("")
If f <> Nil Then
If f.Exists Then
Dim t As TextInputStream
Try
t = TextInputStream.Open(f)
't.Encoding = Encodings.MacRoman
TextField1.Text = t.ReadAll
Catch e As IOException
t.Close
MsgBox(“Error accessing file.”)
End Try
End If
End If

Thanks in advance :slight_smile:

If it is an actual preference type information, you may want to check out REALEasyPref, makes for easy cross platform preference saving…

http://code.google.com/p/realeasyprefs/

RealEasyPref looks very interesting to me too, I’ll take a look as well.

Use GetFolderItem and supply the path to the file instead of GetOpenFolderItem or GetSaveFolderItem :slight_smile:

Thanks :slight_smile: