I\'ve tried numerous methods to list all non-visual components of a form such as OpenDialog, ImageList, TableAdapters, etc and could not find anything. To find the on-screen con
private IEnumerable<Component> EnumerateComponents()
{
return this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
.Where(f => typeof(Component).IsAssignableFrom(f.FieldType))
.Where(f => !typeof(Control).IsAssignableFrom(f.FieldType))
.Select(f => f.GetValue(this))
.OfType<Component>();
}