Results 1 to 2 of 2

Thread: [RESOLVED] OpenText method clears data in text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    9

    Resolved [RESOLVED] OpenText method clears data in text file

    I use a text file to store the settings from my program.
    Now when i save the settings the text file gets created and everything works correctly. I can load the settings without any error.

    Now when i quit my program and star it up again clicking the load button will clear out any data in my text file. So the file still exist but it empty.

    It happens when my program runs this line of code.

    Code:
    Dim o_read As system.IO.streamReader = system.IO.File.OpenText("C:\test.txt")
    That just tells o_read that it is a stream reader and which file to read.
    How does my file get cleared out by that?
    Does anyone know what is going on?

  2. #2
    Frenzied Member MattP's Avatar
    Join Date
    Dec 2008
    Location
    WY
    Posts
    1,227

    Re: OpenText method clears data in text file

    There's no way that could be clearing out your file as it's really just calling the StreamReader(String) constructor overload.

Tags for this Thread

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