bool ischecked = (bool)this.dataGridView1.Rows[e.RowIndex].Cells["Column2"].FormattedValue;
if (ischecked == true)
{ aa += Convert.ToDecimal(dataGridView1.CurrentRow.Cells["UEE_price"].Value.ToString());
this.lbtotal.Text = aa.ToString();
}
else if (ischecked == false)
{
aa -= Convert.ToDecimal(dataGridView1.CurrentRow.Cells["UEE_price"].Value.ToString());
this.lbtotal.Text = aa.ToString();
}点击checkbox的时候,取值积累算总价可是问题是,有的时候这个checkbox是默认就全选,删了再加,就好了,但是点击没有用,点两次才有用
这是为什么
还有就是,checkbox点到头了,还往下点,还会出新列,怎么解决?
if (ischecked == true)
{ aa += Convert.ToDecimal(dataGridView1.CurrentRow.Cells["UEE_price"].Value.ToString());
this.lbtotal.Text = aa.ToString();
}
else if (ischecked == false)
{
aa -= Convert.ToDecimal(dataGridView1.CurrentRow.Cells["UEE_price"].Value.ToString());
this.lbtotal.Text = aa.ToString();
}点击checkbox的时候,取值积累算总价可是问题是,有的时候这个checkbox是默认就全选,删了再加,就好了,但是点击没有用,点两次才有用
这是为什么
还有就是,checkbox点到头了,还往下点,还会出新列,怎么解决?
将单元格的值设为"√"或者什么的标识,代码判断,是"√"就+,不是就-