How to disable the last blank line in DatagridView?

Solution 1:

Do it like this:

myDataGridView1.AllowUserToAddRows = false

Solution 2:

In the DataGridView properties (small arrow at the top right corner of the control) uncheck Enable Adding, or in the Properties window at the right side of the screen set AllowUserToAddRows to False.

Solution 3:

From your Project [Design] view click on the DataGridView1 and from the (Properties) set it like this:

enter image description here

-Or-

Use this code:

DataGridView1.Rows.RemoveAt(DataGridView1.CurrentCell.RowIndex);