forum

Home / DeveloperSection / Forums / How to find controls in winforms c#

How to find controls in winforms c#

Anonymous User 3377 22-Jan-2014

I need to find controls in my forms. In asp.net I used Recursive method to do it, now how to do in winforms?

public static Control FindControlRecursive(Control root, string id)
{
    if (root.ID == id)
        return root;
    return root.Controls.Cast<Control>()
       .Select(c => FindControlRecursive(c, id))
       .FirstOrDefault(c => c != null);
}

any idea..thanks...


c# c# 
Updated on 23-Jan-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By