I need to check whether a control is a descendant of another control. Will Control.Contains
do the job, or does that only search for first-level child controls?
views:
81answers:
2
+1
A:
I just tested it, and it looks like it does indeed do a recursive search.
Blorgbeard
2009-02-23 10:23:15
+6
A:
Control.Contains makes a recursive search. So it will return true for this case:
ctrl1.Contains(ctrl3);
where ctrl1 contains ctrl2, and ctrl2 contains ctrl3 (for example).
BTW: .NET Reflector is a great tool to find out such things.
M4N
2009-02-23 10:23:56