Re: Load Picture from MS Access to VB6

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Well, I figured it out I think. My problem was stemming from the fact that I
loaded images into the database directly through Access (so that I could
have some initial data to play with). When I inserted the image into Access
that way, it stored it as a Microsoft Photo v3.0 object. When VB was trying
to pull that object into the ImageBox, it failed of course. As soon as I
removed all the images from Access and then loaded images onto my form and
had VB save them to the database, everything started working fine.

Of course, now the issue is that graphics are very large when stored in an
Access database, but I guess I'll have to live with that.

Thanks for your help. Your message caused me to look at things from the
Access end where the issue was actually caused from.

As far as how I'm displaying the pictures in VB--pretty simple. I have an
ImageBox inside a PictureBox. The ImageBox is connected to a DAO object with
it's DataField property pointing to the Photo (OLE Object) field in the
Access database. No code used for the retrieval or saving. I only have code
to help resize the photo once it's been retrieved. If you want that I can
post it for you (although I stole it from this newsgroup to begin with).

- The Merg

--
Today's problems don't worry me,
I haven't solved yesterday's yet.

"Paul Clement" <UseAdddressAtEndofMessage@xxxxxxxxxxxxxx> wrote in message
news:17qro1djp5hsdnloe35khtruot3m4nsdo1@xxxxxxxxxx
> On Wed, 30 Nov 2005 12:01:36 -0500, "The Merg"
> <howard_mergler@xxxxxxxxxxxxxxxxxx> wrote:
>
> ¤ I have the field that the pictures are stored in defined as an OLE
> Object.
> ¤
>
> Ouch. Unless the image was stored as binary (w/o the OLE header) you would
> need to use the OLE
> Object control. The alternative is to extract the binary data, strip the
> OLE header and write the
> data out to a file that can then be loaded in the PictureBox or Image
> control. AFAIK you can't bind
> a PictureBox or Image control directly to an OLE Object field in the
> database.
>
> So how are you currently displaying the image (from the database) into a
> PictureBox or Image
> control? If might help if we could see some of the code you are using.
>
> ¤ In VB, I have an image box inside of a picture box. I used some code
> that
> ¤ someone suggested on this newsgroup for resetting the size of the
> picture to
> ¤ the size of the image box. The image box is then linked to the
> appropriate
> ¤ field in the Access database. The image resize function is actually only
> ¤ exectued when the image box is double-click, so that should not be
> affecting
> ¤ anything. Any ideas would be appreciated? If you need anymore
> information,
> ¤ just let me know.
> ¤
> ¤ When you load your pictures into the PictureBox, do they resize
> themselves
> ¤ to the size of the PictureBox? That's really the only operation I need
> ¤ performed on the picture.
>
> If I remember correctly the PictureBox does not resize the image
> automatically. Only the Image
> control will resize the picture if the Stretch property is set to True.
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)


.



Relevant Pages

  • Re: Load Picture from MS Access to VB6
    ... ¤ I have the field that the pictures are stored in defined as an OLE Object. ... Unless the image was stored as binary (w/o the OLE header) you would need to use the OLE ... data out to a file that can then be loaded in the PictureBox or Image control. ...
    (microsoft.public.vb.general.discussion)
  • Re: saving images in access database
    ... ¤ I am trying to use an OLE field in a microsoft access table and bind it ... The PictureBox control does not support OLE objects. ...
    (microsoft.public.vb.database)
  • Re: Saving picture to a database
    ... ¤ Hi ... I'm displaying an image in a picturebox which I want tosave in a SQL2000 ...
    (microsoft.public.vb.database.ado)
  • Re: Load Picture from MS Access to VB6
    ... in code to compact the database via a menu option. ... there is a chance the filename of the photo itself can ... > ¤ Well, I figured it out I think. ... loaded images into the database directly through Access (so that I could ...
    (microsoft.public.vb.general.discussion)
  • Re: Please Help Me in Visual Basic 6.0 SP6
    ... Dim dbPath As String ... Above is my programming where in this programming, ... how can i indicate myself which one i'm gonna insert to the database. ... > ¤ solution where as somebody can help me where to start. ...
    (microsoft.public.vb.database)