منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
حل مشكلة A generic error occurred in GDI+. - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : حل مشكلة A generic error occurred in GDI+. (/showthread.php?tid=32548)



حل مشكلة A generic error occurred in GDI+. - samira20 - 16-12-19

السلام عليكم
عند حفظ صورة في بكتشر في الداتا تظهر هذه الرسالة
A generic error occurred in GDI+.

كود :
    Dim arrImage() As Byte
       Dim mstream As New System.IO.MemoryStream()
       PictureBox2.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Png)
       arrImage = mstream.GetBuffer()
       Dim FileSize As UInt32
       FileSize = mstream.Length
       mstream.Close()
cmd..Parameters.AddWithValue("@imgh", arrImage)



RE: حل مشكلة A generic error occurred in GDI+. - samira20 - 17-12-19

الرجاء المساعدة


RE: حل مشكلة A generic error occurred in GDI+. - asemshahen5 - 17-12-19

هذا كود من احد مشاريع الاخ : حريف برمجة .

PHP كود :
   Private Sub Button9_Click(sender As ObjectAs EventArgsHandles Button9.Click
        
''حفظ الصورة في جدول الصور
        If TextBox2
.Text "" Then
            MsgBox
("قم بتحديد الأسم أولاً من اللست بوكس"64"حريف برمجة")
 
           TextBox2.Focus()
 
           Exit Sub
        End 
If
 
       If (PictureBox1.Image Is NothingThen
            MsgBox
("قم بإدراج الصورة أولاً"64"حريف برمجة")
 
           Exit Sub
        End 
If
 
       '''''''''التأكد من ان رقم السجل موجود في الجدول الأول قبل اضافة الصورة في الجدول الثاني'''''''''
 
       Dim Cmd As New OleDbCommand("select uid from tb1 where uid=@uid"conn)
 
       Cmd.Parameters.AddWithValue("@uid"TextBox1.Text)
 
       conn.Open()
 
       Dim dr As OleDbDataReader Cmd.ExecuteReader
        If dr
.Read False Then
            dr
.Close()
 
           Cmd.Dispose()
 
           conn.Close()
 
           MsgBox("رقم السجل غير موجود في الجدول الأول"64"حريف برمجة")
 
       Else
            Dim ms 
As New System.IO.MemoryStream
            PictureBox1
.Image.Save(msPictureBox1.Image.RawFormat)
 
           Dim picbyte() As Byte ms.GetBuffer
            Cmd 
= New OleDbCommand("insert into tb2 (puid,pphoto,pname) values (@puid,@pphoto,@pname)"conn)
 
           Cmd.Parameters.Clear()
 
           Cmd.Parameters.AddWithValue("@puid"TextBox1.Text)
 
           Cmd.Parameters.AddWithValue("@pphoto"picbyte)
 
           Cmd.Parameters.AddWithValue("@pname"TextBox3.Text)
 
           Cmd.ExecuteNonQuery()
 
           Cmd.Dispose()
 
           conn.Close()
 
           cleartextbox()
 
           MsgBox("تم حفظ السجل بنجاح"64"حريف برمجة")
 
       End If
 
   End Sub