Need REALbasic easy help!

Trip

Registered
I use to know REALbasic fairly well, but it's been years since I last used it. Now I'm trying to create a very basic application but can't figure out how to do it...

Basically I need my app to automatically create a text file using some data in editfields. Then I need the app to automatically load that data from the text file into a list. I've done it before on previous editions of REALbasic but can't figure out how to do it anymore! Please help!
 
Have your old methods stopped working, or have you just forgotten them?

I'm actually still using REALbasic 5, so there may be changes I'm unaware of, but I would assume that using a textOutputStream or binaryStream would still work just fine. Something like this should work:

Save in a Close event:
Code:
  dim f as folderitem
  dim out as textoutputstream
  f=preferencesfolder.child("MyGreatApp Settings.txt")
  out=f.createtextFile
  out.write editfield1.text
  out.close
And load in Open:
Code:
  dim f as folderitem
  dim input as textinputstream
  dim s as string
  f=preferencesfolder.child("MyGreatApp Settings.txt")
  if not f.exists then return
  input=f.openastextfile
  do until input.eof
    listbox1.addrow input.readline
  loop
  input.close

You might want to use output.writeLINE instead of output.write, especially if you're taking data from multiple editFields. But that's the basic idea.

BinaryStreams are much more flexible, but harder to use. For simple tasks, textIn/OutputStreams are effective.

Hope this helps.
 
Wow, great! Thank you very much!
I simply forgot the old code and needed some refreshing. Thank you again, I greatly appriciate your help!
 
Back
Top