-
UserControl Woes
I'm working on a usercontrol and I keep receiving this error when I add controls to it:
"Code generation for property 'Controls' failed. Error was 'Object reference not set to an instance of an object'."
If I go in and write the same code that the code generator would then it works fine but instead it throws this error and fails to write the 'Me.SlidingPanel1.Controls.Add(Button1)' crap in the auto-generated code which means it sends contained controls into limbo.
The Usercontrol inherits from Panel and upon creation adds some controls (set at designtime) to the panel as well has acting like a normal panel. The controls added via the internal collection get added but the drag and drop at designtime ones don't. Also the it seems to happen only when there is both a drag and drop control AND internally added control. If there is just one of these it doesn't have an trouble. Making it even stranger is that both things did work about 2 hours ago, and I'm not sure what changed to make it not work now.