我正在使用 bindingsource 。问题是,当我AddNew()
在绑定源中执行此操作时,它给了我异常Item cannot be added to a read-only or fixed-size list.
此表单是对话框。为了您的审查,我正在添加代码
主窗体代码
private void bindingNavigatorAddNewItem_Click_1(object sender, EventArgs e)
{
try
{
this.Validate();
_earning = (Earning)this.earningBindingSource.Current;
string EmpNo = Convert.ToString(_earning.Empno == null || _earning.Empno == string.Empty ? "0" : _earning.Empno);
Incomes.frmIncomeAddList _earnEmployee = new Incomes.frmIncomeAddList();
_earnEmployee.ShowDialog();
}
catch (Exception ex)
{
}
}
这是对话框表单代码
public frmIncomeAddList( )
{
InitializeComponent();
FillCurrency();
FillDropdown();
FillEarnCode();
FillEarnCodeDESC();
this.earningBindingSource.AddNew();
this.earningBindingNavigatorSaveItem.Enabled = true;
FillDropdown();
}
在对话框表单上 this.earningBindingSource.AddNew();
我遇到异常Item cannot be added to a read-only or fixed-size list.
你能帮我么。提前致谢