Image boxes (send to back, bring to front, etc)

I have two image boxes on a form. Both have '0' in the index property. One of the boxes is behind the other (by this I mean I have right clicked on it and clicked 'send to back' at design time). At runtime, I load new instances of both image boxes, but the instances of the box at the front are behind those of the other. Why is this? Can the order be changed at run time. The new image boxes of the 'in front' variety are created last.
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.

Create the "behind" ones first.

Image1.ZOrder 0
will bring the control to the front.
Image1.ZOrder 1
will send the control to the back.
I may have those values backwards, but in any case, you may want to look up "ZOrder" in the help file.

Use the Zorder method to bring a control to front:

Private Sub Form_Load()
    picFront(0).ZOrder 0 'bring to front
    'Load 2 new boxes and make visible
    Load picFront(1)
    Load picBack(1)
    picFront(1).Visible = True
    picBack(1).Visible = True
    'Reposition the pic boxes
    picFront(1).Move picFront(0).Left, 0
    picBack(1).Move picBack(0).Left, 0
    'Bring this one to front
    picFront(1).ZOrder 0
End Sub

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
Sorry KDivad, didn't see your comment while posting...
Erick37, not a problem.
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
Visual Basic Classic

From novice to tech pro — start learning today.