|
-
Jun 23rd, 2004, 10:06 AM
#1
Thread Starter
Member
variables in text files
Hi, could anyone point me in the direction of a tutorial on saving variables to a text file and then accessing this value at a later date. I know how to write a variable to a textfile using
oWrite.WriteLine(variablename)
oWrite.WriteLine(variablename2)
etc
but how do I read the value back into the variable from the textfile, and if there is more than one value in the text file how do I tell it which value to put into which variable...?
The full code i used for writing the variables to the file is...
----------------------
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
(on form load)
oWrite = oFile.CreateText("C:\Program Files\Folder\filename.txt")
(on button click)
oWrite.WriteLine(variable1)
oWrite.WriteLine(variable2)
oWrite.Close()
----------------------
I know how to open the file at a later date [using 'Dim oRead As System.IO.StreamReader' and 'oRead = oFile.OpenText("C:\Program Files\Folder\filename.txt")'], its everything after that I'm stuck on!
Many thanks in advance for any help you can give and sorry if I don't make enough sense for you to help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|