THE PUTXI PROJECT

Catalonia is Not Spain

FileStream and PictureBox

Posted by putxi on April 24, 2007

Have you got problems with a locked File? Are you searching a unlocker aplication? If your file is locked due to a PictureBox you are doing something badly. You must open the PictureBox like in the following example and the message of “this file is used for another person or application” will desapear

You must use a FileStream like in the following way:

// Make sure that you have added the System.IO namespace.
using System.IO;

// Specify a valid picture file path on your computer.
FileStream fs;
fs = new FileStream("C:\WINNT\Web\Wallpaper\Fly Away.jpg", FileMode.Open, FileAccess.Read);
pictureBox1.Image = System.Drawing.Image.FromStream(fs);
fs.Close();
And remember: CATALONIA IS NOT SPAIN!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>