I would start by making sure that all the option buttons have the same name but a different index value (i.e. a control array of option buttons.)
Next, load you image names into an array variable holding these names, synchronized with the option button numbers.
Then, when the option button is "click"ed, load the corresponding image into a picturebox.
The code would look something like this:
private sub optFoodItem_Click(Index as Integer)
picFoodItem.Picture = LoadPicture(m_strImagePath
end sub
obviously, elsewhere you need code like this:
Private m_strImagePathArray() as string
...
m_strImagePathArray(0) = "C:\Project\Images\Pizza.g
m_strImagePathArray(1) = "C:\Project\Images\Soda.gi
...
Main Topics
Browse All Topics





by: wes_wilsonPosted on 2002-12-02 at 13:40:29ID: 7522109
I'm going to make a couple of assumptions, and if they are true this code should work. First I'm assuming that elements in your arrays match together, element 0 in your buttons array is pizza and element 0 in your thumbnails array is pizza as well. Second, I'm assuming that your thumbnail array just holds the path to the picture ("C:\mypicture.bmp") that kinda thing.
(Index))
btnArray is the name of the option button array, Picture1 is the name of your picture box and ThumbnailArray is the name of the array containing your thumbnails.
Good Luck
-Wes
Private Sub btnArray_Click(Index As Integer)
Picture1.Picture = LoadPicture(Thumbnailarray
Picture1.Refresh
End Sub