views:

407

answers:

1

Hi I am using visual studio 8, vb.net. I have a picture box on my form, picturebox1

I have a number of image files name image1.gif image2.gif image3.gif etc upto image52.gif

I want to display an image in a picturebox dependant upon a value wich is generated elsewhere in the app, so that if '3' is generated I a picturebox to display image3.gif if 2 is generated image2.gif. However I have 52 such images to be displayed in 16 picture boxes so I was wondering if there is a more efficient way than a select case method for each image and each picture box.

All and anyhelp is much appreciated thank you.

+1  A: 

Whenever i have a large number of images i always use an imagelist. You could add the images to the list in the correct order and access the image at the desired index position.But it will help you get rid of one of the select statement but you will still need to have one for the different picture box. This is really only to keep things clean. Performance wise i am not sure you would get that much of a hit by doing multiple select statement.

zaladane
Thanks for that reply.
I hope it helped you. did you figure out how to handle the 4 different picture boxes in an easy enough way?
zaladane