Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of SearchAllChildren Argument in Controls.Find Method

I'm using the Forms.Controls.Find Method to search the child controls of a parent control. The method has 2 arguments; (Key, SearchAllChildren). I know that the Key argument does a string comparison on the child controls' names and fills the return array with the controls that have a matching name. However, I do not know the significance of the SearchAllChildren argument.

The MSDN documentation says: true to search all child controls; otherwise, false. What does this mean? Won't it search all the child controls anyways? Is this to control whether the search is recursive? So if it's true then the search will go through the children of all the children and all the children of the children of the chilren and etc., but if false then it will only go through the first level of children?

Thanks,

like image 639
Ian Avatar asked Dec 08 '25 21:12

Ian


1 Answers

Controls.Find("name", false) will search for direct children only.

Controls.Find("name", true) will look for child controls and recursively search all child controls children, etc.

The docs for this method are really bad. I had to look at the search to be absolutely sure the difference.

like image 183
Samuel Neff Avatar answered Dec 11 '25 00:12

Samuel Neff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!