Home All Groups Group Topic Archive Search About

Getting Pictures from Image list into PictureBox

Author
29 Nov 2007 3:05 PM
Gary Pollard
I have a control array with 37 picture boxes and an image list loaded with
jpg picture.

How do I load the pictures from the image list  into the picture boxes -
everything I have tried fails.

I intend to use a random number for the index so each time they load the
pictures will be in a different sequence.

any help appreciated
Gary

Author
29 Nov 2007 3:18 PM
Ken Halter
"Gary Pollard" <poll***@eol.ca> wrote in message
news:88c50$474ed53e$d8fe9d29$28583@PRIMUS.CA...
>I have a control array with 37 picture boxes and an image list loaded with
> jpg picture.
>
> How do I load the pictures from the image list  into the picture boxes -
> everything I have tried fails.

Try....

Private Sub Command1_Click()
   Picture1.Picture = ImageList1.ListImages(1).Picture
End Sub

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Author
29 Nov 2007 3:30 PM
Norm Cook
Show quote
"Gary Pollard" <poll***@eol.ca> wrote in message
news:88c50$474ed53e$d8fe9d29$28583@PRIMUS.CA...
> I have a control array with 37 picture boxes and an image list loaded with
> jpg picture.
>
> How do I load the pictures from the image list  into the picture boxes -
> everything I have tried fails.
>
> I intend to use a random number for the index so each time they load the
> pictures will be in a different sequence.
>
> any help appreciated
> Gary
>

In general,
Picture1.Picture = ImageList1.ListImages(Index).Picture
where Index is the 1 based index of the pics in the ImageList

If you assign values to the Key property of each image in the ImageList,
you can use
Picture1.Picture = ImageList1.ListImages("SomeKeyValue").Picture
Author
29 Nov 2007 8:01 PM
Gary Pollard
Thanks for putting me on the right track. This is what finally did it.
pbPicture(Index).Picture = ImageList1.ListImages(5).Picture
This statement displays he picture and I can now rework it to randomly load
the pictures
Thanks
Gary

Show quote
"Norm Cook" <normcookNOSPAM@cableone.net> wrote in message
news:13ktmpfm626eu9f@corp.supernews.com...
> "Gary Pollard" <poll***@eol.ca> wrote in message
> news:88c50$474ed53e$d8fe9d29$28583@PRIMUS.CA...
> > I have a control array with 37 picture boxes and an image list loaded
with
> > jpg picture.
> >
> > How do I load the pictures from the image list  into the picture boxes -
> > everything I have tried fails.
> >
> > I intend to use a random number for the index so each time they load the
> > pictures will be in a different sequence.
> >
> > any help appreciated
> > Gary
> >
>
> In general,
>  Picture1.Picture = ImageList1.ListImages(Index).Picture
> where Index is the 1 based index of the pics in the ImageList
>
> If you assign values to the Key property of each image in the ImageList,
> you can use
>  Picture1.Picture = ImageList1.ListImages("SomeKeyValue").Picture
>
>

AddThis Social Bookmark Button