Column A Column B Column C 12.02 10.00 22.02 32.02 10.00 42.02 52.02
private void DgView_CellValidated(object sender, DataGridViewCellEventArgs e) { if (DgView.CurrentCell.ColumnIndex == 0) { DgView.Rows[DgView.CurrentCell.RowIndex].Cells[1].Value = cfun.convertdecimal(DgView.Rows[DgView.CurrentCell.RowIndex].Cells[0].Value.ToString()) + cfun.convertdecimal(txtValue.Text.ToString()); } } private void DgView_RowValidated(object sender, DataGridViewCellEventArgs e) { decimal sum = 0; for (decimal i = 0; i < DgView.Rows.Count+1; ++i) { sum = cfun.convertdecimal(DgView.Rows[DgView.CurrentCell.RowIndex].Cells[1].Value.ToString()) + cfun.convertdecimal(DgView.Rows[DgView.CurrentCell.RowIndex].Cells[2].Value.ToString()); } DgView.Rows[DgASideView.CurrentCell.RowIndex].Cells[0].Value = sum.ToString(); }
long sum = (long)DgView.Compute("Sum(Column A)", "True");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)