hi
try something like: - Private Sub Option1_Click(Index As Integer)
-
Picture1.Picture = LoadPicture()
-
Select Case Index
-
Case Is = 0: Picture1.Picture = LoadPicture(App.Path & "\Picure1.bmp")
-
...
If you want to avoid the delay as each image is loaded, you can load your pictures into six separate Picturebox (or Image) controls once, then just make them visible or not depending on which you want to display. Assuming that these controls are to be in an array, you may find it more convenient to simply create the first one at design time, set the Index property to 0 (zero), then include code something like...
- Private Sub Form_Load()
-
Dim I As Long
-
For I = 1 To 5
-
With Picture1(0)
-
Load Picture1(I) ' Create the new picture box.
-
Picture1(I).Move .Left, .Top
-
End With
-
Next
-
End Sub
Alternatively, you could load the pictures into the controls at design time, so they are stored permanently in your compiled program. Then just use the .Visible property to hide/show them at runtime, or the .ZOrder method to move them in front of or behind each other.
Note: Generally speaking, unless you specifically need properties/methods unique to the picturebox control, you should use the Image control. If it gives you any problems related to size, here's a hint - check out the "Stretch" property.