vb 中 如何获得datagrid 一列值求和

网上找到了,还不行,
DataGrid里面很多数据我不知道如何求和。报错行号无效

帮助一下,谢谢
我的代码是Dim total As DoubleDim rows As Integer, cols As Integer, i As Integertotal = 0rows = DataGrid3.ApproxCountcols = 3 ' 第三列表示For i = 0 To rows - 1DataGrid3.Row = iDataGrid3.Col = colstotal = total + Val(DataGrid3.Text) '求和NextText17.Text = total报错行号无效

datagrid肯定是要绑定一个数据库控件(Data或Adodc)的,你通过数据库控件去统计数据,会比你从表格中读取数据进行统计要方便的多,也要快得多。
温馨提示:答案为网友推荐,仅供参考
相似回答