C# winform datagridview 动态列值计算
来源:互联网 发布:网店交易平台源码 编辑:程序博客网 时间:2024/05/16 17:49
动态计算2列积并给第三列赋值:
DGcountIndex 要赋值列的index
DGcountIndex1要计算列的index
DGcountIndex2要计算列的index
public static void DataGridCount(DataGridView DataGD, int DGcountIndex, int DGcountIndex1, int DGcountIndex2) { if (!DBNull.Value.Equals(DataGD.CurrentRow.Cells[DGcountIndex1].Value) & !DBNull.Value.Equals(DataGD.CurrentRow.Cells[DGcountIndex2].Value)) { DataGD.CurrentRow.Cells[DGcountIndex].Value = Convert.ToSingle(DataGD.CurrentRow.Cells[DGcountIndex1].Value) * Convert.ToInt32(DataGD.CurrentRow.Cells[DGcountIndex2].Value); } }
在dataGridView_CellEndEdit事件中调用
如:计算第二列和第三列,给第四列赋值
DataGridCount(dataGridView1 , 3, 1, 2);
- C# winform datagridview 动态列值计算
- c# datagridview动态修改列
- winform c# datagridview 添加序号列
- C# winform 中怎么在DataGridView中动态添加DateTimePicker列
- [WinForm]dataGridView动态加载以本地图片显示列
- [WinForm]dataGridView自定动态设定序号列框
- C# winform关于datagridview中的列的数据类型转换问题
- C# WinForm下DataGridView单元按钮列(一)
- C# WinForm下DataGridView单元按钮列(二)
- C# Winform datagridview控件绑定数据源后列顺序混乱
- c# winform 用代码修改DataGridView列头的名字,设置列名,修改列名
- C# winform中,动态绑定textbox,combox,datagridview的示例
- c# winform 打印datagridview
- [WINFORM]C#中的DataGridView
- C# Winform DataGridView 全选
- winform datagridview 手动绑定列
- WinForm 处理 DataGridView 按钮列
- winform datagridview加自定义列
- openGL学习笔记1(入门----如何绘制 直线、多边形、圆、利用图片绘制图形等)
- 三天打鱼两天晒网
- 阿富汗美国签署战略伙伴关系协议 民众反应不一
- TI公司LDO电源芯片的选用
- 过滤器
- C# winform datagridview 动态列值计算
- nod32 总是提示 operating system is not up to date
- Java的synchronized关键字:同步机制总结
- 文件下载
- u盘驱动问题
- 开放与封闭性开发讨论
- 序列化:java.io.Serializable
- 敏捷软件测试的文化挑战
- 【评论】为什么Scrum不行?