VB.NET 2003 - form controls automatic setting of parent

I have a form in VB.NET that has many labels and text boxes and what not.  I need to set the parent of each one to a picture box that will be in the background.  Rather than set each one, as in Me.Label1.Parent = Me. Picturebox1, is there a way to do it programmatically?  I've tried this:

        Dim ccnt As Integer = Me.Controls.Count
        For i = 0 To ccnt - 1
            Me.Controls.Item(i).Parent = Me.PictureBox2
        Next

The problem is that the number of controls, ccnt, is at 58 when first initialized.  When the loop runs, the number of controls gradually decreases.  Why?  The index eventually gets out of range and aborts.  Is there a way to do this or do I have to set each one in the load routine?
ddepuemdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dttriCommented:
 Hi,
  The number of controls decrease because when you set a control new parent, it's old parent is not its parent anymore, so the decrease.
  I think you could use this:

        Dim ccnt As Integer = Me.Controls.Count
        For i = ccnt - 1 to 0 step -1
            Me.Controls.Item(i).Parent = Me.PictureBox2
        Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlexFMCommented:
Don't forget also to exclude PictureBox2 itself from this enumeration.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.