A generic error occurred in GDI+

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi to all,
Im making an application that uses a Webcam to capture an image, and i want to store that image in a file to the PC, but im getting the "A generic error occurred in GDI+". The code is as follows:Public Class AltaPromotor

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuardar.Click
Try
If Valida_Forma() = True Then
Dim curDir As String
curDir = My.Computer.FileSystem.CurrentDirectory
Dim cmd As New SqlCommand("INSERT INTO tblPromotor (Promotor, Descripcion, Empresa, Email, Telefono, FechaReg, UserReg) VALUES (@Nombre, @Descripcion, @Empresa, @Email, @Telefono, @FReg, @UReg)", Cnn)
cmd.Parameters.Add(New SqlParameter("@Nombre", CStr(txtNombre.Text)))
cmd.Parameters.Add(New SqlParameter("@Descripcion", CStr(txtDescripcion.Text)))
cmd.Parameters.Add(New SqlParameter("@Empresa", UCase(CStr(txtEmpresa.Text))))
cmd.Parameters.Add(New SqlParameter("@Email", CStr(txtEmail.Text)))
cmd.Parameters.Add(New SqlParameter("@Telefono", CStr(txtTel.Text)))
cmd.Parameters.Add(New SqlParameter("@UReg", "Omar"))
cmd.Parameters.Add(New SqlParameter("@FReg", Date.Now))
Cnn.Open()
cmd.ExecuteNonQuery()
Cnn.Close()
picFoto.Image.Save(curDir & "/Pics/" & txtNombre.Text & Date.Now.Date.ToString & ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
MessageBox.Show("Promotor registrado correctamente.", "TRACKMX", MessageBoxButtons.OK, MessageBoxIcon.Information)
ClearFLD()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally : Cnn.Close()
End Try
End Sub
picFoto is the name of a pictureBox showing the loaded image. Any help of what is wrong would be really appreciated.
Thanks in advance.

View the full article
 
Back
Top