我想计算行的数据列
并显示到文本框的值
如金额= 10
额= 10
额= 10
额= 10
我要显示到文本框
IM尝试此代码,但是在播种行的最后一个值。
double Final = 0;
//decimal Serial = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value);
decimal Quantity = Convert.ToDecimal(dataGridView1.Rows[i].Cells[2].Value);
decimal Rate = Convert.ToDecimal(dataGridView1.Rows[i].Cells[3].Value);
decimal vat = Convert.ToDecimal(dataGridView1.Rows[i].Cells[4].Value);
decimal TotalPrice = Convert.ToInt32(Quantity * Rate);
decimal TempVatTax = TotalPrice * Convert.ToDecimal(dataGridView1.Rows[i].Cells[4].Value) / 100;
TotalPrice = TempVatTax + TotalPrice;
dataGridView1.Rows[i].Cells[5].Value = TotalPrice;
Final = Convert.ToDouble(TotalPrice);
//Final=Convert.ToDouble(txt_Total.Text+Final);
//Final += CInt(row.Cells(0).Text);
txt_Total.Text = Convert.ToString(Final);
}
请告诉我的解决方案:8164209 |会员