I have 1 picture box on my form anf would like to create multiple instances of the same picture box and have an array of identical picture boxes... any way to do this since a picture box is not really an object?
Printable View
I have 1 picture box on my form anf would like to create multiple instances of the same picture box and have an array of identical picture boxes... any way to do this since a picture box is not really an object?
Set the index property of the PictureBox to 0 (zero) to create a control array then use code simular to this to load a new picturebox:
Good luck!Code:Private Sub LoadPicBox()
Dim iUBound As Integer
iUBound = Picture1.UBound + 1
Load Picture1(iUBound)
With Picture1(iUBound)
.Top = .Top + .Height * iUBound
.Visible = True
End With
End Sub
PS. How told you that a PictureBox isn't an object? DS.
Do you want to do it at run time? If so, than set Index property to 0 for your Picture box at design time. At run time put this code at the event you want to this appear:
You can use a loop to load pictures as many as you need.Code:Load Picture1(1)
Picture1(1).Top = Picture1(0).Top + Picture1(0).Height
Picture1(1).Visible = True
Sorry, didn't see previous reply
[Edited by LG on 05-05-2000 at 10:31 AM]
Thanks guys... I wasn't sure how to create a control array.