Tuesday, June 16, 2009

File displayed in PictureBox control became locked

I came across this issue and found this MS KB document very helpful:

Image file is locked when you set the PictureBox Image property to a file (Article ID: 309482 )

I was displaying an image in a picturebox control and then I was trying to overwrite the file, and display a new image. I could not overwrite the file. I could not rename it or delete it either.

Using a Filestream instead of FromFile resolved the issue.

If you run into this problem check out the MS KB document linked above.

No comments:

Post a Comment