CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Posts
    65

    Thumbs up Try to delete a picture file which is loaded in picturebox

    Hi,

    i tried to delete a picture file which is loaded in picturebox using system.io.file.delete method it gives error that "It being used by another Process".

    How to overcome this error. still i used picturebox =null

    Regards,
    Sivakumar.kr

  2. #2
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    1,080

    Re: Try to delete a picture file which is loaded in picturebox

    The help documentation clearly states that if you have created an Image object by calling Image.FromFile then that file is locked until the Image object is Disposed. This means that you need to call Dispose on the PictureBox.Image to release the file. You can use Image.FromStream to create an Image without locking the file in the first place.

  3. #3
    Join Date
    Dec 2003
    Location
    http://map.search.ch/zuerich.en.html
    Posts
    1,074

    Re: Try to delete a picture file which is loaded in picturebox

    jmcilhinney is correct, here is another alternative...something similar on another thread
    Useful? Then click on (Rate This Post) at the top of this post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured