Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete the default first row in the DataGridView in C#?

I would like to delete the first row of the DataGridView before adding any rows through the program.

Instead of deleting through the program, I would rather remove the first row from the DataGridView properties.

Any Idea how to do it ?

Thanks

like image 380
Kiran Avatar asked Sep 18 '25 00:09

Kiran


1 Answers

You appear to be referring to the default new row on an editable DataGridView which allows users to add a new row to the grid using the UI.

To stop this row from appearing you simply set the DataGridView.AllowUserToAddRows property to false, either programatically or in the designer.

like image 197
David Hall Avatar answered Sep 19 '25 14:09

David Hall