这是我的代码片段,给DataGridView的某个单元格赋值,紧接着弹出此单元格的值,可每次弹出的值却是"0"。this.DGVDevice["SaveFlg", e.RowIndex].Value = "1";
MessageBox.Show(this.DGVDevice["SaveFlg", e.RowIndex].Value.ToString());奇怪不?你说奇怪不!
MessageBox.Show(this.DGVDevice["SaveFlg", e.RowIndex].Value.ToString());奇怪不?你说奇怪不!
{
try
{
if(this.dataGridView1 != null)
{
this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value =
e.RowIndex.ToString() + e.ColumnIndex.ToString(); MessageBox.Show(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
}
}
catch (Exception ex)
{
throw ex;
}
}
MessageBox.Show(dataGridView1[1, 0].Value.ToString());
测试是可以的,是不是LZ第一句设置出错了(未设置成功),第二句取到的是原先的值?