C
CSharpNoob2011
Guest
Hi all,
i have a datagridview with two columns (Group& Qty).
int _total = 0;
for (int c = 0; c < GridView1.Columns.Count; ++c)
{
for (int i = 0; i < GridView1.Rows.Count; ++i)
{
_total += Convert.ToInt32(GridView1.Rows.Cells["QTY"].Value);
}
}
//I dont know how to combine both Column and Row loops :S
I would like to have the sum of each group.
Group Qty
A 12
B 14
C 22
A 9
C 17
B 1
A 3
I have to get a return (MessageBox for example):
A = 24
B = 15
C = 39
Thank you,
Please do not forget to click “Vote as Helpful” if the reply helps/directs you toward your solution and or "Mark as Answer" if it solves your question. This will help to contribute to the forum.
Continue reading...
i have a datagridview with two columns (Group& Qty).
int _total = 0;
for (int c = 0; c < GridView1.Columns.Count; ++c)
{
for (int i = 0; i < GridView1.Rows.Count; ++i)
{
_total += Convert.ToInt32(GridView1.Rows.Cells["QTY"].Value);
}
}
//I dont know how to combine both Column and Row loops :S
I would like to have the sum of each group.
Group Qty
A 12
B 14
C 22
A 9
C 17
B 1
A 3
I have to get a return (MessageBox for example):
A = 24
B = 15
C = 39
Thank you,
Please do not forget to click “Vote as Helpful” if the reply helps/directs you toward your solution and or "Mark as Answer" if it solves your question. This will help to contribute to the forum.
Continue reading...