[
  {
    "Id": "1483277",
    "ThreadId": "657834",
    "Html": "Hi,\r<br />\nI have a problem which probably is very easy to solve, but I just don't find a solution.\r<br />\nIn my application a user is importing .csv-files into a database. After the import the .csv-file is being zipped and afterwards deletes from the directory on the filesystem. That works perfectly well.\r<br />\nHowever, the user ought to get the possibility to unzip a specific file again. That works, too. But when I want to delete this file from the zip-archive and save this zip-archive, I always get the error 57, sayint that the process cannot access the file as another process is using it.\r<br />\nThis is my code and any help is appreciated:\r<br />\n<br />\nPublic Shared Sub ExtractOneFile(strZip As String, strFile As String, strDestination As String)\r<br />\n'strZip = Ziparchive\r<br />\n'strFile = das zu entpackende .csv-File\r<br />\n'strDestination = Zielverzeichnis\r<br />\n<br />\nTry\r<br />\nUsing zip As ZipFile = ZipFile.Read(strZip)\r<br />\nDim e As ZipEntry\r<br />\n<br />\nFor Each e In zip\r<br />\n  If e.FileName = strFile Then<br />\n<pre><code>e.Extract(strDestination, ExtractExistingFileAction.OverwriteSilently)\nzip.RemoveEntry(e)\nzip.Save()\nExit For</code></pre>\n\nEnd If\r<br />\nNext\r<br />\n<br />\nEnd Using\r<br />\nCatch\r<br />\n  MsgBox(&quot;Zip-Class; ExtractOneFile&quot; &amp; vbCrLf &amp; Err.ToString)\r<br />\nEnd Try\r<br />\nEnd Sub<br />\n",
    "PostedDate": "2016-09-09T04:24:43.92-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]