【发布时间】:2011-03-21 20:52:48
【问题描述】:
我一直在开发一个应用程序,但遇到了一个我以前从未见过的异常错误。我有两个类,一个是 UserControl,一个是 Form,设置如下:
namespace NC
{
public partial class Board : UserControl
{
// stuff
}
}
namespace NC
{
partial class Board
{
// this is the *.designer.cs file
}
}
namespace NC
{
public partial class MainForm : Form
{
// normal form stuff
}
}
namespace NC
{
partial class MainForm
{
// this is the *.designer.cs file. it has a Board added to it.
}
}
它们都包含在同一个项目中,因此不应该成为问题。但是,我在编译时得到了这个:
The type name 'Board' does not exist in the type 'NC.NC'
我查看了表单的设计器文件,发现了这个:
this.Board1 = new NC.Board();
我删除了命名空间,它工作正常。每次我访问表单编辑器时,它都会再次添加它。我以前从来没有遇到过这个问题。是否有某种设置或我可以更改的东西?
【问题讨论】:
标签: c# winforms namespaces