A generic error occurred in GDI+. while saving

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RobT
    New Member
    • Aug 2010
    • 14

    #1

    A generic error occurred in GDI+. while saving

    So here's the problem-

    My app has an image in it in a picture box. I need the end user to be able to change it. So the code I added below should do that. However, I get the "A generic error occurred in GDI+. while saving"

    I understand it as this- possibly an error saving it to C:\?? Because when I save it to a folder such as MyPictures or Pictures it saves A-ok.

    Does anyone have a solution? It really needs to go in a folder on c:\

    Code:
        Private Sub btnChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChange.Click
            Dim dlg As New OpenFileDialog
            With dlg
                .Title = "open"
                '.Filter = "GIF Files (.gif)|*.gif"
                .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
                .FileName = "logo"
                .ShowDialog()
            End With
            TextBox1.Text = dlg.FileName
            PictureBox1.ImageLocation = TextBox1.Text
        End Sub
    
        Private Sub btnSaveClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveClose.Click
            If Me.PictureBox1.Image IsNot Nothing Then
                Me.PictureBox1.Image.Save(IO.Path.Combine("C:\DailyLog\", "logo.gif"))
            End If
            Me.Close()
        End Sub
Working...