C#更改表格数据 未将对象引用设置到对象的实例

2025-05-16 03:34:51
推荐回答(1个)
回答1:

id2 = Convert.ToInt32(dataGridView1.Rows[x].Cells["id"].Value.ToString());
string v = dataGridView1.Rows[x].Cells[y].Value.ToString();
你检查一下,看看这两句中是不是有读到未赋初始值的单元格,即循环读取到未NULL的单元格