I have a whole bunch of pictureboxes on my form, they have the name picturebox1, picturebox2...picturebox36, and I was wondering if there was a way I could access them using an array. Would I have to create them using a picturebox array and manually type in their locations and such, because I would not like to do that if possible.
Thanks,
Eric Berger

I found out how to do this:

Public MedalPicBoxes(35) As PictureBox
    Sub InitializePics()
        MedalPicBoxes(0) = PictureBox1
        MedalPicBoxes(1) = PictureBox2
                      ...........
        MedalPicBoxes(34) = PictureBox35
        MedalPicBoxes(35) = PictureBox36
    End Sub

I found out how to do this:

Public MedalPicBoxes(35) As PictureBox
    Sub InitializePics()
        MedalPicBoxes(0) = PictureBox1
        MedalPicBoxes(1) = PictureBox2
                      ...........
        MedalPicBoxes(34) = PictureBox35
        MedalPicBoxes(35) = PictureBox36
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.