using System.Linq; using System.Windows.Forms; namespace mRemoteNGTests.TestHelpers { public static class FormExtensions { /// /// Finds a control with the specified name on a form. /// /// The type of control to find. /// The form. /// The name of the control to find. /// The control or null if not found or the wrong type. public static T FindControl(this Form form, string name) where T : Control { return form.Controls.Find(name, true).SingleOrDefault() as T; } } }