我一直在开发一个应用程序,遇到了一个我从未见过的异常错误。我有两个类,一个是用户控件(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();
我删除了命名空间,它正常工作。每次访问表单编辑器时,它会再次添加。以前从未遇到过任何问题。是否有一些设置或其他东西可以更改?