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

查看:108
本文介绍了如何从DataGridView控件的底部删除空行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用数据填充DataGridView时,底部总是有一个空行。
如何禁用这个?

When I fill a DataGridView with data, there is always an empty row at the bottom. How do I disable this?

推荐答案

是的,底部总是有一个空行code> 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.

要禁用它,您还需要阻止用户添加新行。请执行以下操作:设置 您的 DataGridView 控件的AllowUserToAddRows 属性为False:

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天全站免登陆