Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Forms inheritance CreateInstanceImpl
 

Forms inheritance CreateInstanceImpl

I have some chain of inheritance forms (one form inherited from other) and I have change their constructors to have parameters and I got the following error in the design view while the project compiled.

I have found out that all forms should have a default (parameter less constructor) and that fixes the problem.

Does any body know how to handle this problem without changing the constructor? My ancestor form holds some objects that all other forms uses. For that inheritance was made isn’t it?

at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.ComponentModel.Design.DesignSurface.CreateInstance(Type type)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

Shauliz  Monday, July 10, 2006 5:02 PM

Hi,

I am not sure, and as far as I know we don't plan to fix it. I am fairly new to WinForms, but I don't believe this is something we changed for 2005 - although I could be wrong.

Martin

Martin Thorsen - MSFT  Monday, July 10, 2006 10:10 PM

Hi,

In order for the designer to display a user control, the control (as you found out) must have the default constructor If your base form holds some objects that all derived forms use, one pattern is to add an Initialize method.

Martin

Martin Thorsen - MSFT  Monday, July 10, 2006 6:52 PM

Does this "feature" documented? Does Microsoft try to fix it?

It like in the old good days :) that there was no constructor so we wrote initialize/constructor as method.

Shauliz  Monday, July 10, 2006 8:42 PM

Hi,

I am not sure, and as far as I know we don't plan to fix it. I am fairly new to WinForms, but I don't believe this is something we changed for 2005 - although I could be wrong.

Martin

Martin Thorsen - MSFT  Monday, July 10, 2006 10:10 PM

You can use google to search for other answers

Custom Search

More Threads

• Changing parent at DesignTime inside inherited control
• Panel control
• Embeded WindowsMediaPlayer has bugs
• Suggested Additions to Modifiers
• Designer Error
• Design time control naming
• problem in CheckBOx checkedchanged event..
• How do I develop a design time only control?
• Feature rich .NET ComboBox control released!
• Cannot access Index or Dynamic Help