public static void HandleDeleteCourse(ListView lvwCourse, string id_course) { foreach (ListViewItem item in lvwCourse.Items) { if (item.SubItems[0].Text == id_course) { bool result = CourseDAL.DeleteCourseWithId(id_course); if (result) { lvwCourse.Items.Remove(item); RenderListViewDataCourses(lvwCourse); } return; } } MessageBox.Show(MessageBoxText.NotSelectListView, MessageBoxText.CaptionWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning); }