如何从DataGridView控件的底部删除空行? [英] How do I remove the empty row from the bottom of a DataGridView control?

查看:227
本文介绍了如何从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.

要禁用它,你将还需要prevent从添加新行的用户。通过设置执行此操作的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.allowusertoaddrows.aspx"><$c$c>AllowUserToAddRows你的的DataGridView 控制,以假房产:

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屋!

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