DataGridView in rows.Count more than 1 reason and solutions than the actual number of rows

Scenes

DataGridView realize how to add, delete, move up, move down one line:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102814145

Note:

Blog home page:
https://blog.csdn.net/badao_liumang_qizhi
public concern number of
programs overbearing ape
acquisition-related programming e-books, tutorials and push for free download.

In implementing the above effect is found, the actual result will be more real than the number of rows when Count Gets the rows of dataGridView.

achieve

the reason

dataGridView.rows.count the last line blank counted.

The default in the final surface has a blank line, allowing users to directly add this line.

Even if the read-only attribute datagridview.readonly, this line will still display the page, but can not be edited.

solve

It will allow the user to automatically add a property to false

this.dataGridView_Task_ViewEdit.AllowUserToAddRows = false;

Here is the method of adding it to the load comprising the DataGridView form.

Guess you like

Origin www.cnblogs.com/badaoliumangqizhi/p/11763475.html
Recommended