如何在dtagridview中查找2列的乘法并在第3列中显示答案 [英] how to Find the multiplication of 2 Columns in a dtagridview and display the answer in 3rd column

查看:77
本文介绍了如何在dtagridview中查找2列的乘法并在第3列中显示答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

col1 col2 = col3
2 3 = 6

这是我的代码

双倍数量= Double.Parse(row.Cells ["clmQuantity"].Value.ToString());
Double purrate = Double.Parse(row.Cells ["clmPurRate"].Value.ToString());
双倍金额= Math.Round(数量*精制,2);
数量= Double.Parse(row.Cells ["clmAmount"].Value.ToString());

col1 col2 = col3
2 3 = 6

this is my code

Double quantity = Double.Parse(row.Cells["clmQuantity"].Value.ToString());
Double purrate = Double.Parse(row.Cells["clmPurRate"].Value.ToString());
Double amount = Math.Round(quantity * purrate, 2);
amount = Double.Parse(row.Cells["clmAmount"].Value.ToString());

推荐答案

尝试一下,
try this,
foreach (DataGridViewRow row in dataGridView1.Rows)
           {
               row.Cells["clmAmount"].Value = (Double.Parse(row.Cells["clmQuantity"].Value.ToString()) * Double.Parse(row.Cells["clmPurRate"].Value.ToString())).ToString();
           }




希望对您有帮助




Hope this helps


这篇关于如何在dtagridview中查找2列的乘法并在第3列中显示答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆