DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   How do you access pictureboxes as arrays (http://www.daniweb.com/forums/thread151176.html)

eberger2001 Oct 14th, 2008 6:58 pm
How do you access pictureboxes as arrays
 
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

eberger2001 Oct 19th, 2008 4:48 am
Re: How do you access pictureboxes as arrays
 
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

eberger2001 Oct 19th, 2008 4:50 am
Re: How do you access pictureboxes as arrays
 
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


All times are GMT -4. The time now is 7:39 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC