-
Usercontrols....
in my usercontrol I have a PictureBox property. I want it to list all the pictureboxes that are available on the form... for example when you have a Notify Icon, there is a ContextMenu property in the properties window. When you click on it, it will list all the context menus on the form
I want to do the same thing, but I want my usercontrol to list the pictureboxes on the form
I think it has something to do with collections, but I dont know anything about them. How can I do this? :confused:
-
Each form has a Controls collection, which will contain all the controls on the form - incidentally controls that contain other controls, a la the Panel and others, also have a Controls collection which contains all controls that live inside the parent control.
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWindowsFormsFormControlCollectionClassTopic.htm
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemwindowsformsformcontrolcollectionmemberstopic.htm
Seems to me like you could examine the collection a lot like any other kind of collection, using .IndexOf to find particular controls or .Count to determine how many controls and then walk through each one in a loop... For your task the first thing I'd try is looping through all the controls in the collection and examining every PictureBox type? I dunno, I haven't tried something like that yet. Good luck.