vb.net DataGridView - 如何隐藏“新”行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3432825/
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
DataGridView - how to hide the "new" row?
提问by Mawg says reinstate Monica
My DataGridView is read-only - the user cannot enter data into it, so that empty row at the end (the "new" row?) just looks ugly.
我的 DataGridView 是只读的 - 用户无法向其中输入数据,因此末尾的空行(“新”行?)看起来很难看。
How can I prevent it from displaying?
我怎样才能阻止它显示?
回答by p.campbell
On the form designer view, click the little arrow to the right on the DataGridView. Adjust the value for Enable Adding
. That will remove the row at the bottom of your grid.
在表单设计器视图上,单击 DataGridView 右侧的小箭头。调整 的值Enable Adding
。这将删除网格底部的行。
Programmatically, you can adjust the AllowUserToAddRows
property.
以编程方式,您可以调整该AllowUserToAddRows
属性。
myGrid.AllowUserToAddRows = False
回答by David Hall
The DataGridView
has a boolean property AllowUserToAddRows
. Set this to false and you should no longer see the empty row at the end of the grid.
该DataGridView
有一个布尔属性AllowUserToAddRows
。将此设置为 false,您将不会再看到网格末尾的空行。
回答by user3892995
Just a clarification for other people who are looking at this for WPF the datagrid property has been renamed to CanUserAddRows
只是为其他正在查看 WPF 的人澄清 datagrid 属性已重命名为 CanUserAddRows