LowLevel
LowLevel

Reputation: 1095

VB.NET Designer error: How to (correctly) inherit form that inherits form?

I want to make kind of template Class BaseDialog, but when making a final dialog MyDialog1, which inherits BaseDialog, I get errors, then the dialog cannot be shown in design mode. Following is the list of errors I get.

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 

And also: Warning 1 The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file:

MyDialog1 --- The base class '[mynamespace].BaseDialog' could not be loaded.  Ensure the assembly has been referenced and that all projects have been built.

Here are examples of classes I make (together with .designer file, <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _, Dispose etc., for both classes).

Public Class BaseDialog
Inherits System.Windows.Forms.Form
'
End Class

Public Class MyDialog1
Inherits BaseDialog
'
End Class

Can anyone tell me what I do wrong, please?

Upvotes: 4

Views: 3000

Answers (1)

LowLevel
LowLevel

Reputation: 1095

Already solved. Sorry! http://support.microsoft.com/kb/967050

Cause

The Form Designer requires a compiled assembly in order to display an inherited form. If the base form class is contained within an assembly that was compiled using the x64 or Itanium options, they cannot be opened by the Form Designer. This is because Visual Studio is a 32-bit process, and cannot execute code in a 64-bit (x64 or Itanium) module.

Resolution

Make sure the base form(s) are defined in an assembly that is compiled using the "AnyCPU" build option. This allows form classes defined within the assembly to be used in either a 32-bit process (such as Visual Studio), or in a 64-bit custom process.

Upvotes: 1

Related Questions