Visual Basic ComboBox help!

CaptainCool
09-06-2003, 06:48 PM
I'm making a program in visual basic and need some help with some code.

Ok, I have a combo box named "cboComputer" and some images named "imgPowerful"and "imgExtreme".
In the list of the combo box I have "Powerful" and "Extreme".

Now when I run my program I want one of the images to appear when the user clickes on one of the items in the combobox. An example would be if a user clicked on the "Powerful" item in the box then the "imgPowerful" should appear on screen.

I hope someone can help me out or point me to a real good web site that might have something on it that can help me.
Thanks in advanced.

Sorry if this has been posted before.

4d5e6f
09-06-2003, 07:19 PM
you can use an imagecombo if you want images next to each item, but I dont think thats what you want. since your box only has a set amount of things, put this code into a Timer

if cboCombo.text="Powerful" then 'if the text your combobox="Powerful" then
imgExtreme.visible=false 'make the "Extreme" image not visible
imgPowerful.visible=true 'make the "Powerful" image visible
end if

if cboCombo.text="Extreme" then
imgPowerful.visible=false 'make the "Powerful" image not visible
imgExtreme.visible=true 'make the "Extreme" image visible
end if

Lar_19
09-06-2003, 07:49 PM
That will work just fine if you are only planning to have a couple of images. If you go with more than that, I'd suggest using an array of image controls. That way you can synchronize the array indices with the combo box's ListIndex property. Making it a lot easier to toggle the visible property of the correct image.

CaptainCool
09-06-2003, 07:58 PM
Thanks for the help, I posted this at 2 other forums and no one replied.
From now on I'll be coming here for my VB needs :)

Lar_19
09-06-2003, 08:18 PM
Welcome aboard! :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum