Delete a file in use in runtime

后端 未结 4 1729
南旧
南旧 2021-01-23 11:31

How to delete a file which is in use/open by some process in runtime. I am using vb.net for my project and a image is shown in picturebox, and that should be deleted, without cl

4条回答
  •  粉色の甜心
    2021-01-23 11:39

    I don't think that it is possible. On windows, you cannot delete a file which has open handles. http://support.microsoft.com/kb/320081

    However, from your description you don't need to keep the file open in your application. Open the file, read the image then close the file. Then the file can be deleted but the application will still have the image data.

提交回复
热议问题