PDA

View Full Version : [SOLVED] Combobox decides the picture to show



CuriousGeorg
12-10-2013, 06:47 AM
Good afternoon,

Im hoping this is quite simple to do.

I have a few pictures stored in folders across the drive.

What I have is a userform with a combo box with the names of each picture

What I need is when I select one of the items in combobox the picture in picture control changes.

so if cbo = Image 1.. then then picturecontrol shows image1.jpg

etc..

is there an easy way to do this?

mikerickson
12-10-2013, 07:22 AM
You could put each of the pictures into an Image control of its own and set the .Visible property of each image to False, except for the one selected via combobox.

Aflatoon
12-10-2013, 07:27 AM
If you have the full path in the combobox, the code would just be something like:
Set Me.Image1.Picture = LoadPicture(me.combobox1.value)

CuriousGeorg
12-10-2013, 07:37 AM
and if I didnt have the file path in the combobox (bearing in mind this will be a bit silly!) would I be able to use a vlookup for it?

Aflatoon
12-10-2013, 07:57 AM
Yes - as long as you have it stored somewhere (although ti would make sense to load it into the combobox at the same time as the file name, even if it's hidden ;))