Results 1 to 4 of 4

Thread: Saving to a text file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2003
    Location
    Ft. Worth, TX
    Posts
    16

    Saving to a text file

    I need to save the values of several variables to a text file can somebody please give me an example of the code used to save the variables named (var1, var2, var3, var4, var5) to a text file and then retrieve them.

  2. #2
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    the "sandbox" project at the link below my name show how to read and write text files

  3. #3
    Lively Member dedub's Avatar
    Join Date
    Dec 2002
    Location
    NC
    Posts
    98
    Code:
    On Error GoTo fileerror
    ' creates a file if one is not made
    'and writes what is in text box, output overwrites and append adds to
    Open "c:\text.txt" For Append As #1 
        Print #1, Text1.Text
    Close #1
    Exit Sub
    fileerror:
    MsgBox "file error"
    take this code and change the print line to your variable. ie..
    Print #1, var1
    and so on

    good luck
    R.L.T.W. A+, NET+, CCNA

    Doin' my best

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Alternatly:

    You may want to investigate .ini files or the Registry to save and retrieve data.


    Bruce.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width