RE: File.Delete problem solved

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: N Thorell (NThorell_at_discussions.microsoft.com)
Date: 10/22/04


Date: Fri, 22 Oct 2004 06:41:08 -0700

I think Bob Powell (MVP) has addressed the problem on his 'faq' site.
The trick seems to be to make a copy of the image immediately, and release
the original ImageFromFile object. (On the other hand I actually used the
method new Bitmap(filename).)

http://www.bobpowell.net/faqfeed.xml

"N Thorell" wrote:

> I get 'file in use' exception when I call File.Delete("myFile.jpg").
> But I can't see any reason for that. The file is open by any application.
> I have loaded the file into an PictureBox.Image earlier, but after that I
> have made
> Image.Dispose() and Image = null and GC.Collect().
> So the question is: Why is the .JPG file still 'in use' ???



Relevant Pages

  • Re: Years, Months and Days between tow dates
    ... Bob Powell [MVP] ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Remove a line drawed by DraLine()
    ... For reasons why you shouldn't use CreateGraphics see the GDI+ FAQ. ... >> Bob Powell [MVP] ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Drawstring method
    ... Bob Powell [MVP] ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: how to flash Notify Icon?
    ... Bob Powell [MVP] ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SPAM Alert
    ... Timo's FAQ. ... newsgroup, when that is certainly not the case - at least not for all those ... resources promoted by MVP and non-MVP alike). ... >>while before posting to make sure it is an appropriate place for their ...
    (microsoft.public.windowsxp.general)