jimday1982 Posted August 4, 2003 Posted August 4, 2003 Hi, I have a program that lets the user open a picture and make changes to it, but when trying to save the picture, it says that the file is currently in use and cannot be saved. Is there any way around this? Thanks! Quote
*Experts* Volte Posted August 4, 2003 *Experts* Posted August 4, 2003 What are you using to open the picture? Quote
jimday1982 Posted August 4, 2003 Author Posted August 4, 2003 The code we have for opening the picture is: Private Sub btnPic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPic.Click 'Open dialog box to import a picture With ofd .CheckFileExists = True .CheckPathExists = True .Filter = "Images|*.bmp;*.tiff;*.jpg;*.jpeg;*.png;" .Multiselect = False .ShowHelp = False .Title = "Select an Image" End With If ofd.ShowDialog() = DialogResult.OK Then Dim tmpBMP As New Bitmap(ofd.FileName) CoverPic.Image = tmpBMP End If End Sub Thanks! Quote
Administrators PlausiblyDamp Posted August 4, 2003 Administrators Posted August 4, 2003 When you read in the picture are you closing the stream or leaving it open? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jimday1982 Posted August 4, 2003 Author Posted August 4, 2003 Ok, this is probably the problem. We are opening the picture by calling the location (c:\blah\blah.jpg) which is stored in a text file. txtcoverpic.Text = objReader.ReadLine If txtcoverpic.Text = "" Then CoverPic.Image = Image.FromFile(txtcoverpic.Text) End If How do we go about closing the file so we can overwrite it? Thanks! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.