private void btnExcluir_Click(object sender, EventArgs e) { bool flagLog = true; try { panelAlterar.Visible = false; Panel pnlAux = panelsAdded[logica]; Logica aux = (Logica)logicas[logica]; flagLog = aux.removerInstrucao(pos); } catch { MessageBox.Show("Nada para remover"); } if (!flagLog) { logicas.Remove(logicas[logica]); } redraw(); }