public void RemoveMedicine() { String text = "Do You Want To Remove " + ListSelectedDoctor.Value + " ?"; DialogResult answer = System.Windows.Forms.MessageBox.Show(text, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (answer == DialogResult.Yes) { ((ResidentPatient)Hospital.Patients[PatientID]).History.Remove(ListSelectedMedicine.Key); HospitalDB.DeleteMedicine(ListSelectedMedicine.Key); MedicalHistoryList.Remove(ListSelectedMedicine); } }