void saveToControlList()
{
ClassTableControls ctc = new ClassTableControls();
ctc.controls = new List<string>();
ctc.tablename = myproject.selectedTable;
int i = 0;
foreach (DataGridViewRow row in dataGridView1.Rows)
{
int rowcount = dataGridView1.Rows.Count - 1;
if (i < rowcount)
{
string control = row.DataGridView[6, i].Value.ToString();
ctc.controls.Add(control);
}
i++;
}
//loop to check if the table is present
for (int x = 0; x < tableControls.Count; x++)
{
if (tableControls[x].tablename == ctc.tablename)
{
//table already exist so remove it before adding
tableControls.Remove(tableControls[x]);
}
}
//table doesnt exist so lets party and add it
tableControls.Add(ctc);
}