Load Gif(Access OLE Object) into PictureBox.
-
Hi! I know how to save an image into an Access DataBase in a binary format and retrieve it in a memorystream and display it in a picturebox, only problem is .Gif files. I found the way to save(.Gif Files) into a Database, but when I try retrieving it, it gives an Error. I need help very urgently. any help will be extremely appreciated.:-D
-
Hi! I know how to save an image into an Access DataBase in a binary format and retrieve it in a memorystream and display it in a picturebox, only problem is .Gif files. I found the way to save(.Gif Files) into a Database, but when I try retrieving it, it gives an Error. I need help very urgently. any help will be extremely appreciated.:-D
A GIF file is no different than any other image file. If the code works for one file format, it'll work for another, PROVIDED that the code is written properly. What's the code you're using to store the image and retrieve the image look like?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Hi! I know how to save an image into an Access DataBase in a binary format and retrieve it in a memorystream and display it in a picturebox, only problem is .Gif files. I found the way to save(.Gif Files) into a Database, but when I try retrieving it, it gives an Error. I need help very urgently. any help will be extremely appreciated.:-D
If it is very very very urgent you maybe could read the error message, look at the stack traceback, and use line numbers to locate the problem. We can't.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
If it is very very very urgent you maybe could read the error message, look at the stack traceback, and use line numbers to locate the problem. We can't.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
well,
Dim img As Object = dataset.Tables(0).Rows(0)(0) Dim imgObject() As Byte = CType(img, Byte()) Using theMemStream As New IO.MemoryStream() theMemStream.Write(imgObject, 0, imgObject.Length) theMemStream.Position = 0 PictureBox1.Image = Image.FromStream(theMemStream) End If End Using
this is the code that I used, but it gave me this error: first Error: "A generic error occurred in GDI+" Error Code = "-2147467259" Second Error: (on cont...) "Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang." Third Error: (on cont...) "Attempting to call into managed code without transitioning out first. Do not attempt to run managed code inside low-level native extensibility points, such as the vectored exception handler, since doing so can cause corruption and data loss." -
well,
Dim img As Object = dataset.Tables(0).Rows(0)(0) Dim imgObject() As Byte = CType(img, Byte()) Using theMemStream As New IO.MemoryStream() theMemStream.Write(imgObject, 0, imgObject.Length) theMemStream.Position = 0 PictureBox1.Image = Image.FromStream(theMemStream) End If End Using
this is the code that I used, but it gave me this error: first Error: "A generic error occurred in GDI+" Error Code = "-2147467259" Second Error: (on cont...) "Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang." Third Error: (on cont...) "Attempting to call into managed code without transitioning out first. Do not attempt to run managed code inside low-level native extensibility points, such as the vectored exception handler, since doing so can cause corruption and data loss."This code is barely passable for reading image data and reconstituting it. What does the code look like that wrote the image to the database? After all, what good is the code that reads it (even if good) if the code that wrote it didn't do it correctly?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
well,
Dim img As Object = dataset.Tables(0).Rows(0)(0) Dim imgObject() As Byte = CType(img, Byte()) Using theMemStream As New IO.MemoryStream() theMemStream.Write(imgObject, 0, imgObject.Length) theMemStream.Position = 0 PictureBox1.Image = Image.FromStream(theMemStream) End If End Using
this is the code that I used, but it gave me this error: first Error: "A generic error occurred in GDI+" Error Code = "-2147467259" Second Error: (on cont...) "Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang." Third Error: (on cont...) "Attempting to call into managed code without transitioning out first. Do not attempt to run managed code inside low-level native extensibility points, such as the vectored exception handler, since doing so can cause corruption and data loss."Hi, your error code is 0x80004005 (E_FAIL), its most likely cause is a bad image file. Assuming the exact same code runs fine with other image file types, I suggest you try another GIF file (preferably originating from a completely different source). :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google