Results 1 to 4 of 4

Thread: An array of instances of a picture box??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    103
    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?

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    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:
    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
    Good luck!

    PS. How told you that a PictureBox isn't an object? DS.

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    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:
    Code:
    Load Picture1(1)
    Picture1(1).Top = Picture1(0).Top + Picture1(0).Height
    Picture1(1).Visible = True
    You can use a loop to load pictures as many as you need.

    Sorry, didn't see previous reply

    [Edited by LG on 05-05-2000 at 10:31 AM]

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    103
    Thanks guys... I wasn't sure how to create a control array.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width