I don't know what is the syntax for emptying a datagridview. Please help me here is my code.
if (cboProduct.SelectedIndex != -1)
load_variant();
else
//empty the datagridview
cboProduct.SelectedIndex = -1;
set datasource as null
dataGridView1.DataSource = null;
Or
dataGridView1.Rows.Clear()
OR
while (dataGridView1.Rows.Count > 0)
{
dataGridView1.Rows.RemoveAt(0);
}