int s = 0;
int ss = 0;
for(int i = 0;i<datagrid1.rowcount-1;i++)
{
for(int c = 1;c < 4;c++)
{
s = s+(int)datagrid1[c,i].value;
}
datagrid1[4,i].value = s;
ss = ss + s;
}
datagrid1[3,datagrid1.rowcount-1].value = "ผลรวม =";
datagrid1[4,datagrid1.rowcount-1].value = ss;