Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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!
Posted

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!

Posted

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...