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?
I need to check whether a control is a descendant of another control. Will
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Control.Contains makes a recursive search. So it will return true for this case:
where ctrl1 contains ctrl2, and ctrl2 contains ctrl3 (for example).
BTW: .NET Reflector is a great tool to find out such things.