Results 1 to 6 of 6

Thread: Open "C:\02.dat" For Append As #1

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    Unhappy

    I have this in my code:

    Code:
    Open "C:\02.dat" For Append As #1
    Write #1, txtuser.Text, txtpass.Text
    Close #1
    now if someone runs the program

    it saves to that file

    now if someone runs the program again, it adds to the file


    how do I make it so that if the person opened the program the second time, it would replace what was already there, instead of add to it?
    NXSupport - Your one-stop source for computer help

  2. #2
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    Don't use the Open...Append.

    Instead, try this:

    Code:
    Open "c:\02.dat" For Output As #1
        Write #1, txtuser.Text, txtpass.Text
    Close #1

  3. #3
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    You having file problems again, dimava?
    reeset is correct: When you open for APPEND, lines (records) are added to the end of the file (if the file does not exist, it will be created). When you open for OUTPUT, a new file will be created (or overwritten) every time.
    "It's cold gin time again ..."

    Check out my website here.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    ok, thanks it works!!!
    NXSupport - Your one-stop source for computer help

  5. #5
    Guest
    Dimava, if you are adding text to a file..say Autoexec.bat, you'd use Append. If you want to write a file or overwrite it, than you would use Output.

    Understand? Good .

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    Cool

    ok, thanks, I get it
    NXSupport - Your one-stop source for computer 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
  •  



Click Here to Expand Forum to Full Width