如何从 DataGridView 控件底部删除空行? [英] How do I remove the empty row from the bottom of a DataGridView control?
本文介绍了如何从 DataGridView 控件底部删除空行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我用数据填充 DataGridView 时,底部总是有一个空行.如何禁用此功能?
When I fill a DataGridView with data, there is always an empty row at the bottom. How do I disable this?
推荐答案
是的,DataGridView
的底部总会有一个空行.它允许用户在运行时添加新数据;他们所要做的就是开始在新行中输入.
Yes, there will always be an empty row at the bottom of a DataGridView
. It allows the user to add new data at run-time; all they have to do is start typing in the new row.
要禁用它,您还需要阻止用户添加新行.通过设置 AllowUserToAddRows您的
为 False:DataGridView
控件的 code> 属性
To disable it, you will also need to prevent the user from adding new rows. Do this by setting the AllowUserToAddRows
property of your DataGridView
control to False:
myDataGridView.AllowUserToAddRows = false;
这篇关于如何从 DataGridView 控件底部删除空行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文