Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 244
Mawg says reinstate Monica Avatar asked Aug 08 '10 02:08

Mawg says reinstate Monica


People also ask

How to disable auto generated rows in DataGridView in c#?

Simply set the DataGridView. AllowUserToAddRows property to false .

How to remove default row in DataGridView vb net?

The first way is to right click the DataGridView and then click Properties item from the Context menu. Now from the Properties window, look for AllowUserToAddRows property and set it False.


2 Answers

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.

alt text

Programmatically, you can adjust the AllowUserToAddRows property.

myGrid.AllowUserToAddRows = False
like image 81
p.campbell Avatar answered Nov 02 '22 12:11

p.campbell


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.

like image 44
David Hall Avatar answered Nov 02 '22 14:11

David Hall