我有:
public partial class TableForm : Form
{
[DefaultValue( "author" )]
public string tableName;
public TableForm( string tableName )
{
this.tableName = tableName;
InitializeComponent();
}
}
但是在方法InitializeComponent()
错误的第一行:
...
this.dataGridView.DataMember = this.tableName;
...
仅在表单设计器中出错,程序运行正常。
答案 0 :(得分:0)
你的意思是"表单设计师" 中的错误,而不仅仅是"表单构造函数" ?
如果是这样,请尝试为表单创建一个私有的无参数构造函数:
private TableForm()
{
InitializeComponent();
}