2015-02-02 7 views
3

Я хочу создать шаблон Class BaseDialog, но при создании окончательного диалога MyDialog1, который наследует BaseDialog, я получаю ошибки, тогда диалог не может отображаться в режиме разработки. Ниже приведен список ошибок, которые я получаю.Ошибка конструктора VB.NET: Как (правильно) наследовать форму, которая наследует форму?

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) 

А также: Предупреждение 1 Конструктор не может быть показан для этого файла, так как ни один из классов внутри него не может быть разработан. Конструктор просмотрел следующие классы в файле:

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

Вот примеры классов, которые я делаю (вместе с .Цвет дизайна файла, <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _, Dispose и т.д., для обоих классов).

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

Public Class MyDialog1 
Inherits BaseDialog 
' 
End Class 

Может ли кто-нибудь сказать мне, что я делаю неправильно, пожалуйста?

+4

, а не обновлять * вопрос * следует добавить, что в качестве ответа * * поэтому вопрос может быть помечен как ответил – Plutonix

ответ

0

Уже решена. Сожалею! http://support.microsoft.com/kb/967050

Причина

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.

Разрешение

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.