int row = datagridview1.rowcount;
int money = 0;
for(int i = 0 ; i < row ; i++)
{
int wage = convert.toint32(datagridview1.rows[i].cells[7].value.tostring());
int amount = convert.toint32(datagridview1.rows[i].cells[5].value.tostring());
int price = convert.toint32(datagridview1.rows[i].cells[4].value.tostring());
int discount = convert.toint32(datagridview1.rows[i].cells[6].value.tostring());
int total = wage+(amount*(price-(price*discount)/100)));
datagridview1.rows[i].cells[8].value = total.tostring();
money = money+total;
}
textbox1.text = money.tostring();
Code (VB.NET)
Dim money As Integer = 0
For i As Integer = 0 To row - 1
Dim wage As Integer = convert.toint32(datagridview1.rows(i).cells(7).value.tostring())
Dim amount As Integer = convert.toint32(datagridview1.rows(i).cells(5).value.tostring())
Dim price As Integer = convert.toint32(datagridview1.rows(i).cells(4).value.tostring())
Dim discount As Integer = convert.toint32(datagridview1.rows(i).cells(6).value.tostring())
Next
textbox1.text = money.tostring()