Question Incapable of moving image file

bigklaxer

Member
Joined
Jul 2, 2009
Messages
6
Programming Experience
1-3
Hey, I've been working on a program that will be used to categorize image files. However, whenever the program actually gets to the point where it will move the image, it freezes and says it cannot run the process because the file is already in use by another process. The following is the code I used to set the image to be organized in a picture box, and then to clear the image, and then to move it, respectively.

pctbxFileViewer.Image = Image.FromFile(txtSource.text)

pctbxFileView.Image = Nothing

System.IO.File.Move(txtLocation.Text, txtDirectory.Text & folderName & newName & ".jpg")

I was wondering if anyone could tell me why this is. Thanks in advance.
 
Cool thanks!

Also, I was actually experimenting a little bit with the code and I found that if I do pctbxLocation.Load(image) then it actually works with out bringing up an error. Could anyone explain the reasoning behind this?
 
PictureBox.Load uses the Image.FromStream method.
 
Back
Top