Results 1 to 1 of 1

Thread: [RESOLVED] Problem with writing a string to a file several times

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Posts
    133

    Resolved [RESOLVED] Problem with writing a string to a file several times

    Hi I'm having issues regarding writing several strings to a txt file.

    The sub starts like this
    Code:
    Dim ss As New FileStream("Settings.conf", FileMode.OpenOrCreate, FileAccess.ReadWrite)
            Dim s As New StreamWriter(ss)
    Writing and close
    Code:
                s.BaseStream.Seek(0, SeekOrigin.Begin)
                s.WriteLine(info.StoreName)
                s.WriteLine(info.aName)
                s.WriteLine(info.aID)
                s.Close()
    But when i click the button several times, it says that the file is being used by another process. My guess is that s wasn't closed?

    Edit: Also, how do I enable a button after clicking another button?
    Last edited by azsx123; Feb 17th, 2010 at 09:04 PM.

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