How to disable the last blank line in DatagridView?

后端 未结 3 1418
余生分开走
余生分开走 2020-12-29 01:07

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.

相关标签:
3条回答
  • 2020-12-29 01:49

    Do it like this:

    myDataGridView1.AllowUserToAddRows = false
    
    0 讨论(0)
  • 2020-12-29 01:49

    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.

    0 讨论(0)
  • 2020-12-29 01:53

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

    -Or-

    Use this code:

    DataGridView1.Rows.RemoveAt(DataGridView1.CurrentCell.RowIndex);
    
    0 讨论(0)
提交回复
热议问题