private void removeButton_Click(object sender, EventArgs e) { try { data.RemoveSubject(subject.Id); MessageBox.Show("Dėstomas dalykas pašalintas iš sistemos"); foreach (Label l in this.Controls.OfType <Label>()) { l.Visible = false; } removeButton.Visible = false; } catch (Exception exc) { MessageBox.Show(exc.Message); } }