I have a DataGridView
like this:
How is the code to calculate data from Column Total
and show it in a Label
? It means the Label will show 2650
I have a DataGridView
like this:
How is the code to calculate data from Column Total
and show it in a Label
? It means the Label will show 2650
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();