计算列datagridview [英] calculated columns datagridview

查看:84
本文介绍了计算列datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是vb.net编程的新手,想知道如何为datagridview中的计算列创建/编码,例如列数量*列sales =列总销售数量。任何帮助都将受到赞赏

hi am new to vb.net programming,would like to know how to create/code for calculated columns in datagridview such that say a column quantity*column sales=column total sales.any help will be appreciated

推荐答案

你可以用两种方式做到这一点。

1.在绑定表中,添加一个计算列,然后将其绑定到网格视图

检查以下链接如何添加计算列。

http:// msdn。 microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.90).aspx [ ^ ]

http://www.c-sharpcorner.com/blogs/5646/adding -a-calculated-column-to-a datatable.aspx [ ^ ]



2.使用dataGridView1_CellValidated方法并添加计算值到新专栏。

http://stackoverflow.com/questions/6097370/calculation-in-datagridview-column [ ^ ]
you can do this in two way.
1. in your binding table, add a calculated column, and then bind that to the grid view
check the following link how to add the calculated column.
http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.90).aspx[^]
http://www.c-sharpcorner.com/blogs/5646/adding-a-calculated-column-to-a-datatable.aspx[^]

2. Using dataGridView1_CellValidated method and add the calculated value to new column.
http://stackoverflow.com/questions/6097370/calculation-in-datagridview-column[^]


这篇关于计算列datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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