How to delete a specific row in a C# DataGridView?
To remove a specific row in the DataGridView, you can use the DataGridView.Rows.Remove method. Here is an example:
int rowIndex = 2; // 要删除的行索引
dataGridView1.Rows.RemoveAt(rowIndex);
The above code will delete the specified row, where dataGridView1 is the name of the DataGridView control. Please make sure the specified row index is within a valid range, otherwise an exception will be thrown.