title: Vb.net the process cannot access the file because it is being used by another process
body: <p>Hello i wanted to open an csv file and write text in it.
  Here is the code: </p>
  
  <p>Try</p>
  
  <pre><code>    Dim path As String = "C:\Users\daaemoon\Desktop\Test.csv"
      Dim reader As StreamReader = New System.IO.StreamReader(File.OpenRead(path))
  
      Dim sw As New StreamWriter(path)
      Dim s As String = String.Empty
  
      While reader.Peek() &gt;= 0
          Dim line As String = reader.ReadLine()
          Dim values As String() = line.Split(";"c)
          listforfalsecsv.Add(values(0))
          s = s + line + Chr(10)
      End While
      reader.Close()
      sw.Write(s)
      sw.Close()
  
  
  Catch ex As Exception
      MessageBox.Show(ex.Message)
  End Try
  </code></pre>
  
  <p>i got the error by the following line:</p>
  
  <pre><code>  Dim sw As New StreamWriter(path)
  </code></pre>
  
  <p>If i use the method reader.dispose() after that line             <code>Dim reader As StreamReader = New System.IO.StreamReader(File.OpenRead(path))</code></p>
  
  <p>i come to the while loop, but than i got an error: From an closen Textreader could not been read.</p>
  
  <p>I need help, please help me.</p>