在gridview中取两个列的乘积 [英] taking product of two colums in gridview

查看:88
本文介绍了在gridview中取两个列的乘积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在gridview中拥有colums productquntity和总成本.

我想乘以它们,并在模板字段中具有标签的另一列中显示它们..如何执行任何编码示例

解决方案

在DataGridView中尝试一下CurrentCellDirtyStateChanged活动

 私有 无效 DGViewIn_CurrentCellDirtyStateChanged(对象发​​件人,EventArgs e)
        {
            // 检查当前单元格是否已更改
            如果(DGViewIn.IsCurrentCellDirty ==  true )
            {

DGView.CurrentRow.Cells [ 3 ].Value =  int  .Parse(DGView.CurrentRow.Cells [ 1 ].Value.ToString())* int.Parse(DGView.CurrentRow.Cells [ 2 ]. Value.ToString());
DGView.CommitEdit(DataGridViewDataErrorContexts.Commit);
}
} 


尝试以下操作:

GridView TemplateField计算值


i have a colums productquntity and total cost in gridview.

i want to multipy them and show them in another column having a label in template field.. how to do it pls give any coding example

解决方案

Try this in DataGridView CurrentCellDirtyStateChanged Event

private void DGViewIn_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            //Check if the Current Cell is Changed
            if (DGViewIn.IsCurrentCellDirty == true)
            {

DGView.CurrentRow.Cells[3].Value=int.Parse(DGView.CurrentRow.Cells[1].Value.ToString())*int.Parse(DGView.CurrentRow.Cells[2].Value.ToString());
DGView.CommitEdit(DataGridViewDataErrorContexts.Commit);
}
}


Try following:

GridView TemplateField Calculated Values


这篇关于在gridview中取两个列的乘积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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