c# - how to delete file -


Hi, I have a Winform that uses this to display this configuration (which I load into the image box, I create this image box in runtime).

)

When I select any of this image and delete it (I Folder), but problem when I delete it: file. Delete (path_OF_Image);

C # gives me the message that can not delete this file because the process uses this file.

But I settle all the picture boxes or containers (my entire picture box is)

But the problem still exists.

I'm assuming that you're loading the file name directly by using (ie Image.FfrFile ); This can be caused by troubleshooting because NIIT being hanged on resources used by GDI + Library, so I recommend loading file bytes for the first time, and then I will initialize that image. For example:

  byte [] imageBytes = File.ReadAllBytes (fileName); Image image; (MemoryStream MS = New MemoryStream (ImageBits)) {image = Image.FromStream (ms); }  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -