|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting Pictures from Image list into PictureBoxI 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 "Gary Pollard" <poll***@eol.ca> wrote in message Try....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. 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
Show quote
"Gary Pollard" <poll***@eol.ca> wrote in message In general,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 > 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 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 > > |
|||||||||||||||||||||||