}//Load the Services into the list view when form loads private void btnServiceRemove_Click(object sender, EventArgs e) { bool Valid = true; //If a item is selected in the list view perform delete if (lstServiceView.SelectedItems.Count > 0) { //Ask user for conformation DialogResult deleteI = MessageBox.Show("Are you sure you want to delete this Service?", "WARNING: DELETE Service", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //Get user for conformation if (deleteI == DialogResult.Yes) { Service RService = lstServiceView.SelectedItems[0].Tag as Service; //Parse the object to the Service logic to perform action try { //Sl.ServiceInPckage(RService); if (Sl.ServiceInPackage(RService) == false) { Sl.Removeservice(RService); } } catch (ServiceExistsException ex) { MessageBox.Show(string.Format("DELETION ANOMOLY {0}", ex)); Valid = false; } if (Valid == true) { MessageBox.Show("Service successfully deleted", " DELETED", MessageBoxButtons.OK, MessageBoxIcon.Information); lstServiceView.Clear(); } //Hide this form and dispay the Dialog for the Service Contract Manu Hide(); frmServiceContract form = new frmServiceContract(); form.ShowDialog(); LoadServices(); } } else { MessageBox.Show("No Record was selected", "SELECTION", MessageBoxButtons.OK, MessageBoxIcon.Information); } }//Remove a service With Custom Exception