---
title: "How to find controls in winforms c#"  
description: "How to find controls in winforms c#"  
author: "Anonymous User"  
published: 2014-01-22  
updated: 2014-01-23  
canonical: https://www.mindstick.com/forum/1855/how-to-find-controls-in-winforms-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to find controls in winforms c#

I need to find [controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net) in my forms. In [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) I used Recursive [method](https://www.mindstick.com/forum/166/webservice-method) to do it, [now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-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...

## Replies

### Reply by Pravesh Singh

Hi Goti,\

Each control has a Controls property which in fact is a ControlCollection. This collection itself has a method Find() which takes 2 parameters. The first parameter is the name of the control which you want to find, the second parameter indicates wether to include all children into the search.

## As a sample:

```
Control[] allButton1 = this.Controls.Find("button1", true);// for your exampleControl[] foundControls = this.Controls.Find(root.Name,true);
```


---

Original Source: https://www.mindstick.com/forum/1855/how-to-find-controls-in-winforms-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
