返回首页

我想计算行的数据列
并显示到文本框的值
如金额= 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 |会员

回答

评论会员:游客 时间:2012/02/06
计算当前单元格,并显示在文本框的双重价值
Banci Gurjar
评论会员:游客 时间:2012/02/06
{体C3}:8164209|会员
其工作,但及其运作,唯一的工作只有一次,如果我点击ON按钮对细胞计算一次我想离开。

如果我按一下按钮,我再次按ON按钮计算不准确的,我做双记录