Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Designer generated code missing the new xxx() for my control
 

Designer generated code missing the new xxx() for my control

Hi all,

I have user controls from a 2003 project that I've converted to 2005. If I create a new form and add one of these controls to the form, the code inside InitializeComponent() does not contain a line to create the instance of the user control. There is code generated to populate the properties, however. Obviously, this crashes if I run it. This does not occur with every control, but at least two of them.

I've done full rebuilds, closed VS and restarted, and monkeyed around with the property to generate a member variable. Nothing has helped. Please tell me this is something I've missed. I really don't want to go a regenerate all my user controls!

Any ideas on what can cause this wonderfully aggravating behavior?

WNC

WineNCheese  Wednesday, May 31, 2006 12:33 AM

Do those controls have a public parameterless constructor ?

Mike Danes  Wednesday, May 31, 2006 8:10 AM
What controls are they?
Karthik Krishnaswami  Wednesday, May 31, 2006 7:44 AM

They are all controls that I have created, derived either directly from Control, or from UserControl. I have had no problems until now. Unless someone comes up with a solution by tomorrow AM (PST), I'm going to start recreating the controls (in 2005), because that seems to get around this.I've got several controls to convert, and I can't understand why I have to. Unfortunately, every time I make a change on a form in design view that has one of these controls on it, the creation of the control is removed from the generated code.

WNC

WineNCheese  Wednesday, May 31, 2006 7:51 AM

Do those controls have a public parameterless constructor ?

Mike Danes  Wednesday, May 31, 2006 8:10 AM
Hmmmm. The constructor is internal. Thanx. Should have seen that. Strange that this wasn't a problem b4.
WineNCheese  Wednesday, May 31, 2006 3:48 PM

You can use google to search for other answers

Custom Search

More Threads

• Is it possible to give more than one control focus?
• How to Import a VS 2005 form into VS 2008
• Please help me!
• member field for custom component not getting added to form
• Two Name property of UserControl
• Some forms can't be designed
• ComboBox - Apply XP-Theme
• Inherited UserControl - how to change base controls?
• manual position of Form2 from Form1
• Understanding: TextBox.MaximumSize Property and MinimumSize Property.