Hello, for a project of mine I inherited a ComboBox to change its size behaviour. In addition to this i wanted, to speed up my forms' creation, to set the default DropDownStyle
to ComboBoxStyle.DropDownList
To do this i used the [Default()]
command overwriting the DropDownStyle
property
[DefaultValue(ComboBoxStyle.DropDownList)]
public new ComboBoxStyle DropDownStyle
{
get
{
return base.DropDownStyle;
}
set
{
base.DropDownStyle = value;
}
}
Then i modified the default value in the Designer setting the DropDownStyle
to ComboBoxStyle.DropDownList
.
And here comes the problem...
There is a small number of InheritedComboBox which i want to have ComboBoxStyle.DropDown
because they need to work with
AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;
AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
If i set it from the Designer it works fine, however, sometimes, after i rebuild the form, it throws an exception (also at design time) regarding the ComboBoxStyle. When i look to the FormName.Designer.cs file, i can find that for the specific InheritedComboBox there is no
DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown
and I have to add it manually. This is a little boring because sometimes i just notice it at runtime, when the program throws an exception without showing the form and i cannot test every form every time i rebuild...
Do you have any idea why i get this strange behaviour?
Is there any way to fix it?
Thanks a lot for any answer!