Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Im creating several picturebox objects in a loop and I'm using timer to move each one of them to some direction (automatic - no keypress or anything).
my problem is that at some point I need that 1 picurebox(p1) will stand on another one(p2), but since I've created p1 before p2 , p1 is always behind p2 (bring to front isn't working for me..
can you suggest any solution ?
I get the picture order from a database so I can't just change the order myself ..

hope you understand me without the code.. :/
Posted

1 solution

Remove it from the Controls array and reinsert it at the end:
VB
Controls.Remove(myPictureBox)
Controls.Add(myPictureBox)
The last added object will be on top of the others.
Alternatively, sort them into the order you do want, and add them all at once in that order.
Remember that you can use the SQL ORDER BY clause to select the order in which records are returned from your DB as well.
 
Share this answer
 
Comments
danait25 4-Jul-12 3:42am    
Hi,
I tried that- but it still doesn't work... maybe it's something else that I'm missing?

any other suggestions?...
danait25 4-Jul-12 8:05am    
thanx - I used your idea for something else that helped :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900