private void btnCategoryUpdate_Click(object sender, EventArgs e) { try { if (txtStatus.Text != "") { bool d = StatusRepo.checkIfStatusExists(txtStatus.Text); if (d) { MessageBox.Show("This status already exists"); } else { StatusRepo.update(this.id, txtStatus.Text); MessageBox.Show("Status has been updated."); List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; btnCategoryAdd.Enabled = true; clearAll(); } } else { MessageBox.Show("Status has been updated."); } } catch (Exception) { MessageBox.Show("Please select an item to update."); } }