开发者

DataGridView - how to hide the "new" row?

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.

How can I prevent it from displaying?


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 - how to hide the "new" row?

Programmatically, you can adjust the AllowUserToAddRows property.

myGrid.AllowUserToAddRows = False


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.


Just a clarification for other people who are looking at this for WPF the datagrid property has been renamed to CanUserAddRows

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜