private void btnDeleteRow_Click(object sender, EventArgs e) { foreach (TableTemplate dbRow in listOfColumnTemplates) { if (dbRow.IsControlPanelClicked == true) { dbRow.Dispose(); listOfColumnTemplates.Remove(dbRow); break; } } TableTemplate.ReGenerateIndexes(listOfColumnTemplates); }