Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Load Gif(Access OLE Object) into PictureBox.

Load Gif(Access OLE Object) into PictureBox.

Scheduled Pinned Locked Moved Visual Basic
helpdatabasecomtutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NANCO
    wrote on last edited by
    #1

    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

    D L 2 Replies Last reply
    0
    • N NANCO

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • N NANCO

        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

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        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


        N 1 Reply Last reply
        0
        • L Luc Pattyn

          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


          N Offline
          N Offline
          NANCO
          wrote on last edited by
          #4

          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."

          D L 2 Replies Last reply
          0
          • N NANCO

            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."

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • N NANCO

              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."

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              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


              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups