6
Answers

c# datagridview cells multiplications with sum

Luv L

Luv L

10y
1.6k
1
hi,

i used code for below datagridview cells sum
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  {
  int sum = 0;
  for (i = 0; i < dataGridView1.Rows.Count - 1; i++)
  {
  if (dataGridView1.Rows[i].Cells[0].Value != null)
  {
  sum += Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString());
  label1.Text = Convert.ToString(sum);
  }
  }
  }
  }
but i want to below like my cell[0].value sum is shown in label is ok ,but if i can use multipled by any numbers like below image the answer should be = 40
see below details how its come
5+4 = 9 * 2 = 18
(18+2) * 2 = 40





 




Answers (6)