// 遍历每一行的 lup foreach(dataGridView1.Rows 中的 DataGridViewRow 行){
if (dataGridView1.Rows[0].Cells["Payment"].Value.ToString()!="0")
{
dataGridView1.Rows.Remove(row);
}
// 遍历每一行的 lup foreach(dataGridView1.Rows 中的 DataGridViewRow 行){
if (dataGridView1.Rows[0].Cells["Payment"].Value.ToString()!="0")
{
dataGridView1.Rows.Remove(row);
}
Not sure but if you are removing rows while you cycle through them, you may be skipping rows. If you delete a row and then increment your index, you may skip the next row. Would you try cycling backwards through the table like this link suggests? Similar question