如何使用datagridview添加小计和大计 [英] How to using datagridview add subtotal and grandtotal

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

问题描述

大家好,

我有大问题.我不怎么在datagridview上计算小计和大计.
请帮忙,谢谢.

Hi All,

I have big problem. I don''t how to calculate subtotal and grandtotal on datagridview.
Please help and thanks

推荐答案

如果您想将datagridview的特定列中存在的值相加,请按照以下步骤操作:
If you mean that you want to add up the values present in a particular column of the datagridview, then go about like this:
Dim subtotal as integer = 0
For Each row As DataGridViewRow In DataGridView1.Rows
   subtotal += row.Cells(0).Value         
Next


这篇关于如何使用datagridview添加小计和大计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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