如何计算datagridview中特定列的总值 [英] How to count total value of particular column in datagridview
本文介绍了如何计算datagridview中特定列的总值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
任何人都可以告诉我如何计算datagridview中特定列的值。比如说datagridview中有QTY列现在最后我要计算总数量。假设我输入''10数量''然后下次我输入''20数量''。现在总数量应显示30文本框。
我该怎么做!!
Hello there,
Can anyone plz tell me how do i count values of particular column in datagridview. for say "there is QTY column in datagridview" now at the end i want to count total QTY. suppose i entered ''10 qty'' then next time i entered '' 20 qty''. now the total qty should be displayed ''30'' text box.
how can i do that !!
推荐答案
Dim VBal As Integer
For x As Integer = 0 To DataGridView1.Rows.Count - 1
VBal + = Val(DataGridView1.Rows(x).Cells(QTY)。Value)
下一页x
TextBox1.Text = VBal
Dim VBal As Integer
For x As Integer = 0 To DataGridView1.Rows.Count - 1
VBal += Val(DataGridView1.Rows(x).Cells("QTY").Value)
Next x
TextBox1.Text = VBal
这篇关于如何计算datagridview中特定列的总值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文