private void dataGridView3_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{ double sum = 0;
if (e.ColumnIndex == 7)
{
for (int i = 0; i < this.dataGridView3.Rows.Count; i++)
{
double d = 0;
double.TryParse(this.dataGridView3.Rows[i].Cells[7].Value.ToString(), out d);
sum += d;
}
}
this.txtgather.Text = sum.ToString();
}
我想在datagridview值发生改变的时候触发的统计的,不知道怎么的报错了
说我这句double.TryParse(this.dataGridView3.Rows[i].Cells[7].Value.ToString(), out d);
未将对象引用设置到对象的实例
{ double sum = 0;
if (e.ColumnIndex == 7)
{
for (int i = 0; i < this.dataGridView3.Rows.Count; i++)
{
double d = 0;
double.TryParse(this.dataGridView3.Rows[i].Cells[7].Value.ToString(), out d);
sum += d;
}
}
this.txtgather.Text = sum.ToString();
}
我想在datagridview值发生改变的时候触发的统计的,不知道怎么的报错了
说我这句double.TryParse(this.dataGridView3.Rows[i].Cells[7].Value.ToString(), out d);
未将对象引用设置到对象的实例
是不是这个为NULL了