Answer by
cmc94 (302)
How did you add the rows. if it was manual, then this ought to work:
if (this. dataGridView1. DataSource! = null)
{
this. dataGridView1. DataSource = null;
}
else
{
this. dataGridView1. Rows. Clear();
}
The above command will clear the rows collection.