0

I have a DataGridView like this:

enter image description here

How is the code to calculate data from Column Total and show it in a Label? It means the Label will show 2650

1 Answers1

0
int total= 0;
for (int i = 0; i < dataGridView.Rows.Count; ++i)
{
    sum += Convert.ToInt32(dataGridView.Rows[i].Cells[x].Value); //x=column index 
}
label.text = sum.ToString();
BanTim
  • 82
  • 1
  • 9