private void button_ChangeStatus_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow item in this.dataGridView1.SelectedRows)
{
BindingList<BugClass> bindingList = new BindingList<BugClass>();
bindingList = this.bindingSource.DataSource as BindingList<BugClass>;
bindingList[item.Index].Status = txtBox_StatusChange.Text;
}
}
我不断收到“对象引用未设置为对象的实例”。我知道这是因为它没有被初始化,但是,它在这里被初始化,表明有一个空类:
BindingList<BugClass> bindingList = new BindingList<BugClass>();
然后一旦出现以下行,它就会变为 null:
bindingList = this.bindingSource.DataSource as BindingList<BugClass>;
我在这里先向您的帮助表示感谢