Why does WinForms designer keep putting one of the controls' declaration inside the InitializeComponent method after I make a change in the designer?

Viewed 164

I have a Winforms usercontrol with several comboboxes and other controls. In the designer.cs file there's a section at the bottom of the file where the different controls are declared. Whenever I make a change inside the design surface, the new generated .designer.cs file has one of the comboboxes' declaration moved into the InitializeComponent method. This causes a compile error because the usercontrol's partial class in the other .cs file doesn't know about the combobox anymore. So I have to manually move the declaration out of the InitializeComponent method. This odd behavior happens every time I make a change in the design surface.

I went through the designer.cs code and couldn't find what's different about this particular combobox.

Any ideas?

1 Answers
Related