开发者

saving image from picturebox using savefile dialog problem please hep

开发者 https://www.devze.com 2023-02-01 04:48 出处:网络
I have the following code in VB 2010: \'>>>>>CODE FOR SAVING THE CAPTURED IMAGE<<<<<

I have the following code in VB 2010:

'>>>>>CODE FOR SAVING THE CAPTURED IMAGE<<<<<
Private Sub btnSaveSpecimen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Hand开发者_高级运维les btnSaveSpecimen.Click
    'Saves the Image Captured
    Dim Result As DialogResult  'variable declarations
    Dim cap_image As Image

    'opens a save dialog box for saving the settings
    Result = savCaptured.ShowDialog
    If Result = DialogResult.OK Then 
        cap_image = picSpecimen.Image
        cap_image.Save(savCaptured.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
    End If
End Sub

When I run the program, the following error occurs A generic error occurred in GDI+.

How can I resolve this?

please help me TYI


Most of the time when you encounter this error it's either one of two things. These are easy to rule out as the cause so you might want to consider doing that before looking elsewhere.

  1. You attempt to write a file to a directory that you don't have Permission for.

  2. You are trying to write back an image that you still have open.

0

精彩评论

暂无评论...
验证码 换一张
取 消