PDA

View Full Version : Inserting an image based on the option choosen



sarah2010
02-15-2011, 11:52 AM
Hi, I've a VBA form which has got 3 radio buttons to choose an option, say "A", "B", "C". When I choose option "A", I want image "1.jpg" to be displayed in the form. If I choose option "B", I want "2.jpg" & so on. The images are stored in a network drive. I tried creating the radio buttons & I get the return value of which option is choosen. But, I got stuck in displaying the images which change dynamically when changing the options via radio buttons. I attach the file for ref. Appreciate your help!

mdmackillop
02-15-2011, 12:33 PM
Try
Private Sub OptionButton1_Click()
Image1.Picture = LoadPicture("C:\AAA\pic1.jpg")
End Sub

'etc.


Alternatively, add three images hard coded in the userform and switch between them

Private Sub OptionButton1_Click()
Image1.Visible = True
Image2.Visible = False
Image3.Visible = False
End Sub

'etc.

sarah2010
02-15-2011, 02:43 PM
Thank you so much! I like option1 of your suggestion. Thanks again!