Here is my datagridview. I need the sum of AmountBDT where SuspenceAccount is Placid Express.
Sl | SuspenceAccount | AmountBDT |
1 | Placid Express | 30 |
2 | Prabhu Group | 40 |
3 | Placid Express | 20 |
4 | Ria Financial | 70 |
5 | Placid Express | 50 |
Sl | SuspenceAccount | AmountBDT |
1 | Placid Express | 30 |
2 | Prabhu Group | 40 |
3 | Placid Express | 20 |
4 | Ria Financial | 70 |
5 | Placid Express | 50 |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rafnas T PRank #280 · 8.8K reputationPosted Apr 24, 2017, 8:14 PM EDT
Yogendra BhardwajRank #2,141 · 666 reputationPosted Apr 24, 2017, 5:33 PM EDT
foreach (DataGridViewRow row in dataGridView.Rows)
{
if(row.Cells[0].Value=='Placid Express')
sum += (int) row.Cells[2].Value;
}
MessageBox.Show("Sum of all the values is {0}", sum.ToString());
Shovan SahaRank #4,546 · 338 reputationPosted Apr 25, 2017, 8:19 AM EDT