计算DataGrid中的行数 [英] Count the number of rows in DataGrid

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

问题描述

如何计算DataGrid中的行数(无DataGridView)

How count the number of rows in DataGrid (no DataGridView)

推荐答案

int numberOfRows = yourdatagrid.Rows.Count;


简单-获取绑定到DataGridView的集合的数量.
Simple - get the count of the collection that you bind to the DataGridView.




获取数据集或数据表的计数.

Hi,

Get the count of DataSet or datatable..

int i= ds.Tables[0].Rows.Count;




或者,




or,

int i=datagridID.Items.Count;


谢谢.


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

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