Click here to Skip to main content
16,004,919 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: File in use error Pin
TheComputerMan2-Jan-09 5:21
TheComputerMan2-Jan-09 5:21 
GeneralRe: File in use error Pin
Jon_Boy2-Jan-09 5:30
Jon_Boy2-Jan-09 5:30 
GeneralRe: File in use error Pin
TheComputerMan2-Jan-09 6:24
TheComputerMan2-Jan-09 6:24 
GeneralRe: File in use error Pin
Jon_Boy2-Jan-09 7:04
Jon_Boy2-Jan-09 7:04 
GeneralRe: File in use error Pin
Christian Graus2-Jan-09 5:45
protectorChristian Graus2-Jan-09 5:45 
GeneralRe: File in use error Pin
TheComputerMan2-Jan-09 6:22
TheComputerMan2-Jan-09 6:22 
GeneralRe: File in use error Pin
Luc Pattyn2-Jan-09 7:00
sitebuilderLuc Pattyn2-Jan-09 7:00 
AnswerRe: File in use error Pin
Dave Kreskowiak2-Jan-09 6:21
mveDave Kreskowiak2-Jan-09 6:21 
This has been widely documented since the early days of .NET 1.0. The problem is you loaded the image file directly into an Image object in the PictureBox control. The Image object keeps the file locked for it's entire lifetime.

The solution is to load the image using a FileStream, then pass the resulting stream to the construcotr of a new Bitmap object, then close the stream, and assign the Bitmap object to the Image property of the PictureBox.


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: File in use error Pin
TheComputerMan2-Jan-09 6:25
TheComputerMan2-Jan-09 6:25 
GeneralRe: File in use error [modified] Pin
TheComputerMan2-Jan-09 6:44
TheComputerMan2-Jan-09 6:44 
GeneralRe: File in use error Pin
Fabio V Silva2-Jan-09 11:53
Fabio V Silva2-Jan-09 11:53 
GeneralRe: File in use error Pin
TheComputerMan3-Jan-09 4:20
TheComputerMan3-Jan-09 4:20 
GeneralNext Inner Pin
dadashri2-Jan-09 1:44
dadashri2-Jan-09 1:44 
GeneralRe: Next Inner Pin
TheComputerMan2-Jan-09 5:10
TheComputerMan2-Jan-09 5:10 
GeneralRe: Next Inner Pin
Dave Kreskowiak2-Jan-09 6:14
mveDave Kreskowiak2-Jan-09 6:14 
GeneralRe: Next Inner Pin
TheComputerMan2-Jan-09 6:47
TheComputerMan2-Jan-09 6:47 
GeneralRe: Next Inner Pin
Dave Kreskowiak2-Jan-09 6:15
mveDave Kreskowiak2-Jan-09 6:15 
NewsSchool Library System Software RUN-TIME error 713 Pin
dadashri2-Jan-09 1:36
dadashri2-Jan-09 1:36 
GeneralRe: School Library System Software RUN-TIME error 713 Pin
Dave Kreskowiak2-Jan-09 3:42
mveDave Kreskowiak2-Jan-09 3:42 
GeneralRe: School Library System Software RUN-TIME error 713 Pin
Christian Graus2-Jan-09 5:47
protectorChristian Graus2-Jan-09 5:47 
QuestionAdd two mp3 files into one mp3 file. Pin
Gagan.202-Jan-09 0:21
Gagan.202-Jan-09 0:21 
AnswerRe: Add two mp3 files into one mp3 file. Pin
Dave Kreskowiak2-Jan-09 3:44
mveDave Kreskowiak2-Jan-09 3:44 
AnswerRe: Add two mp3 files into one mp3 file. Pin
LloydA1112-Jan-09 5:27
LloydA1112-Jan-09 5:27 
QuestionIssue with : Setting system time Pin
nishkarsh_k1-Jan-09 22:30
nishkarsh_k1-Jan-09 22:30 
AnswerRe: Issue with : Setting system time Pin
Dave Kreskowiak2-Jan-09 3:52
mveDave Kreskowiak2-Jan-09 3:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.