-
I want to create a large number of image objects a loop. I could do this in design time but it seems like I should be able to do something like this:
Loop
imgBall(i).Picture="C:\Ball.jpg"
imgBall(i).Top=7000
i=i+1
Until i= a large number
Any help would be great
Thanks Mike
-
<?>
Code:
Option Explicit
'create a bunch of image boxes with a picture in it.
Private Sub Command1_Click()
Dim MaxId As Integer
MaxId = 4
Dim i
For i = 1 To MaxId
Load Image1(i)
' Set new button under previous button.
Image1(i).Top = Image1(i - 1).Top + 200
Image1(i).Left = Image1(i - 1).Left + 800
Image1(i).Visible = True ' Display new
' button.
Image1(i).Picture = LoadPicture("C:\a wayne\dirtbagdog.gif")
Next i
End Sub
'the image buttons are removed by the Click event
'procedure for the Delete command button (Command2)
Private Sub Command2_Click()
For i = 1 To MaxId
If MaxId < 1 Then Exit Sub ' Keep first buttons.
Unload Image1(i) ' Delete last button.
MaxId = MaxId - 1 ' Decrement button count.
Image1(0).SetFocus ' Reset button selection.
Image1(0).Width = 4000
Next
End Sub