简体   繁体   English

使用保存文件对话框问题从图片框保存图像,请hep

[英]saving image from picturebox using savefile dialog problem please hep

I have the following code in VB 2010: 我在VB 2010中有以下代码:

'>>>>>CODE FOR SAVING THE CAPTURED IMAGE<<<<<
Private Sub btnSaveSpecimen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 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+. 当我运行该程序时,会发生以下错误。GDI +中发生了一般性错误。

How can I resolve this? 我该如何解决?

please help me TYI 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. 您正在尝试写回仍然打开的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM