score:-1
may be this will help you...
how can i get all controls from a form including controls in any container?
once you have the list you can query'em
score:3
something like this should work (not perfect code by any means...just meant to get the idea across):
public ienumerable<control> getselfandchildrenrecursive(control parent)
{
list<control> controls = new list<control>();
foreach(control child in parent.controls)
{
controls.addrange(getselfandchildrenrecursive(child));
}
controls.add(parent);
return controls;
}
var result = getselfandchildrenrecursive(toplevelcontrol)
.where(c => c is textbox || c is checkbox);
Source: stackoverflow.com
Related Query
- How can I query all Childcontrols of a Winform recursively?
- How can I set properties on all items from a linq query with values from another object that is also pulled from a query?
- How can I write the following code more elegantly using LINQ query syntax?
- How can I code a Linq query to do an upward Include?
- How can we express the following code using query expression?
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- How can I code numerous MIN functions into one LINQ to DataSet query
- How can i recursively call, query filter and change an api call using linq?
- How can I get all the children records in a single query if I need to lookup the parent ID?
- How can I reject all changes in a Linq to SQL's DataContext?
- How can I do a Union all in Entity Framework LINQ To Entities?
- How can I trim all elements in a list?
- How can I query an XDocument with a 'path'?
- How can I write Take(1) in query syntax
- How can I trace the query produced by the documentdb Linq provider?
- How can I build Linq query with dynamic OR statements?
- How to understand the following C# linq code of implementing the algorithm to return all combinations of k elements from n
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- How can i write SQL update query with where clause in Entity Framework in C#
- How to query all tables that implement an interface
- How can I view the Entity Framework LINQ query plan cache?
- How can I create a dynamic LINQ query in C# with possible multiple group by clauses?
- How can I switch that code to use LINQ
- How can I combine this code into one or two LINQ queries?
- How can I determine if a LINQ query is going to be LINQ to SQL vs. LINQ to Objects?
- How can I query this hierarchical data using LINQ?
- How can I tell when a LINQ query is enumerated?
- In Umbraco 7, how can i search for all members with a custom property?
- linq - how do you do a query for items in one query source that are not in another one?
- How can I split a List<T> into two lists, one containing all duplicate values and the other containing the remainder?
More Query from same tag
- Entity Framework Object Context Refresh
- Returning the innerlist from a custom collection inheriting from List<T>
- Linq coding style: inline if
- How to check if a value already exists in an xml file using linq
- C# Linq - order IEnumerable by count of identical property
- One way to compare array
- Select distinct on one returned field
- How to add Item based on ID to List and Bind to dropdownlist in Asp.net MVC
- Populating dropdown from selectlist query returns System.Web.Mvc.SelectListItem in dropdownlist
- Return different objects with one LINQtoSQL statement
- How to assign empty string if the value is null in linq query?
- Counting in a List of objects with Linq, between 2 dates
- C# Removing a List from a List
- How to group List array in LINQ
- Fastest way to get matching items from two list c#
- How to directly scan a SQL indexed table
- Creating a List holding a differnet type in place with LINQ?
- Which one is faster/better option to obtain last possible Id in EF: MaxAsync vs LastAsync?
- Dynamically concatenate value in list if pattern matched
- Get X random elements from table in database using Linq or lambda in C#
- linq where according to selected item?
- Method based linq queries
- LINQ: Converting grouped list into new list
- Remove similar entries from a list
- ASP.NET MVC <OutputCache> SqlDependency (CommandNotification?) with LINQ queries
- Find NaN in list of floats and set previous and next element to NaN
- anonymous type and multiple properties
- C# Linq Left Outer Join WHERE clause
- Using autocomplete with LINQ query with an alias
- linq to entities, a where in where clause? (inner where)