How to disable the last blank line in DatagridView?

william picture william · Sep 8, 2010 · Viewed 51.5k times · Source

For C# Window Form, there is a tool called DataGridView.

If we use that to display data, it shows an extra line.

If we have 3 rows of data, it shows 4 rows. the 4th row is a blank row.

I wanna know how to disable it.. or hide it?

Answer

IordanTanev picture IordanTanev · Sep 8, 2010

Do it like this:

myDataGridView1.AllowUserToAddRows = false