Does anybody know how to do a For...Next with all the children's form in a PictureBox?
Printable View
Does anybody know how to do a For...Next with all the children's form in a PictureBox?
Clear your question:
Are you using the SETPARENT API thing here or are you just looking to load up the names of the children forms?
I´m using the SetParent API to set its parent. So, I want to know all the forms that "belongs" to a specific Picturebox.
I don't know what to try. They don't belong to the picturebox's parent, they don't belong to the picturebox itself... it seems as if they were in a "virtual dimension" :) How do you know this?
The best way I can think of is to add each form in the picturebox to a collection, before you call setparent on it. Then you can find out which Form is in the PictureBox by looping through the collection.
I don't know why the GetParent function is not working, but if you use the SetParent to re-set the parent window you can compare the value returned with the picturebox' hwnd property. Oh, and then set back its parent to its previous value if the form wasn't a child of the picturebox...
Nevertheless, I think Megatron's idea is better.
Thanks, Megatron... I will load each form in a collection.