Jose,

The code I gave you is for a simple TEXT file using the TextInputStream and TextOutputStream functions. Don't use anything that will write to the Win Registery unless it is required and many programs really DON'T require it at all. All you really need is a simple text file to hold the End-Users info for the Configuration. No top secret information at all.

CODE Correction: Found that the code had a error in it as instead of f for the folderitem it had c.

Here is the code to read from the text file.
 // Get Configuration info
 Dim strin As TextInputStream
 Dim f As FolderItem
 f = GetFolderItem("MyProgram_CFG.ini")
 If f <> Nil  and f.exists then
     strin = f.OpenAsTextFile
     Name.text = strin.ReadLine
     Address1.text = strin.ReadLine
     Address2.text = strin.ReadLine
     Phone.text = strin.ReadLine
     Email.text = strin.ReadLine
     strin.Close
 End If

Even if the End-User looks at the text file, WHO really cares as it's just his/her own info used for the configration info is all.

NOTE: I even use this for the programs own setup file as when the user runs his copy of the program, it will do what he/she likes it to do. So in the Open of the Main Event Handler, I had 3 foldleritems (c = config, s = setup and u = user) that would check or read the "MyProgram_CFG.ini", "MyProgram_STP.ini" and "MyProgram_USR.ini" files. So when the program started, it was all ready to go, "PreSet" to the users likes.

Here is the code to read from the text file.
 Dim strin1,strin2,strin3 As TextInputStream
 Dim c, s, u As FolderItem

 // Get Configuration info
 c = GetFolderItem("MyProgram_CFG.ini")
 If c <> Nil  and c.exists then
     strin1 = c.OpenAsTextFile
     Name.text = strin1.ReadLine
     Address1.text = strin1.ReadLine
     Address2.text = strin1.ReadLine
     Phone.text = strin1.ReadLine
     Email.text = strin1.ReadLine
     strin1.Close
 End If
 // Get Setup info
 s = GetFolderItem("MyProgram_STP.ini")
 If s <> Nil  and s.exists then
     strin2 = s.OpenAsTextFile
     ProgramName.text = strin2.ReadLine
     ProgramVersion.text = strin2.ReadLine
     strin2.Close
 End If
 // Get User info
 u = GetFolderItem("MyProgram_USR.ini")
 If u <> Nil  and u.exists then
     strin3 = u.OpenAsTextFile
     NumberOfUsers.text = strin3.ReadLine
     strin3.Close
 End If

Very simple...

Jonathon


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.3/331 - Release Date: 5/3/2006

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to