Use this method to set the properties of your controls:
public void Set(object obj, string property, object value) { //use reflection to get the PropertyInfo of the property you want to set //if the property is not found, GetProperty() returns null var propertyInfo = obj.GetType().GetProperty(property); //use the C
Name it as follows:
foreach (Control c in Controls) { Set(c, "SelectedIndex", -1); Set(c, "Text", ""); Set(c, "Checked", false); }
source share