Hello I'm wondering how can I get the sum of a column according with the value in another column. For example I have a DatagridView like this
User Value to sum
-------------------
User1 10
-------------------
User1 15
-------------------
User2 20
-------------------
User3 30
I want to know how can I get the sum for each user.
Expected output
User1: 25
User2: 20
User3: 30
So far I have the code for get the sum of all users but I don't know hot to get per user.
Thanks in advance for everyone.
for (int i = 0; i < dataGridView2.Rows.Count-1; i++)
{
total += Convert.ToInt32(dataGridView2.Rows[i].Cells[ColumnN].Value);
}