I'm looking for help setting a new default property value for an inherited control in Visual Studio:
class NewCombo : System.Windows.Forms.ComboBox
{
public NewCombo() { DropDownItems = 50; }
}
The problem is that the base class property "DropDownItems" has a 'default' attribute set on it that is a different value (not 50). As a result, when I drag the control onto a form, the designer file gets an explicit 'mycontrol.DropDownItems = 50;' line.
At first this doesn't matter. But if later I change my inherited class to 'DropDownItems = 45;' in the constructor this does not affect any of the controls on any form since all those designer files still have the value 50 hardcoded in them. And the whole point was to have the value set in one place so I can deal with the customer changing his mind.
Obviously, if I were creating my own custom property in the subclass, I could give it its own designer default attribute of whatever I wanted. But here I'm wanting to change the default values of properties in the base. Is there any way to apply Visual Studio attributes to a base class member? Or is there some other workaround to get the result I want?
Thanks for any help