vb.net 计算数据网格上的总行数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5953549/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Counting total rows on a datagrid
提问by Sam
I am trying to count all the rows on a datagrid after it has been populated from my DB. I have searched online on how to do this but nothing seems to work.
我试图在从我的数据库填充数据网格后计算数据网格上的所有行。我在网上搜索过如何做到这一点,但似乎没有任何效果。
here is how I grab my data
这是我获取数据的方式
test.SelectCommand = Ssql
test.SelectParameters.Clear()
test.DataBind()
where test is my datasource it gets thrown into. Any help is appreciated TY!
其中 test 是我的数据源,它被扔进了。任何帮助表示赞赏 TY!
回答by Arantes Albert
My code for this thing is:
TextBox3.Text = DataGridView1.RowCount
it display the number of row populated with some data.
我的代码是:
TextBox3.Text = DataGridView1.RowCount
它显示填充了一些数据的行数。
回答by Hyman
Gets or sets number of rows displayed.
获取或设置显示的行数。
test.RowCount
test.RowCount
Can also use.
还可以用。
test.Rows.Count
test.Rows.Count