private void gridControl_ChuongTrinh_ProcessGridKey(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete && gridView_ChuongTrinh.State != DevExpress.XtraGrid.Views.Grid.GridState.Editing) { if (XtraMessageBox.Show("Bạn có muốn xóa danh mục này hay không?", "Bệnh viện điện tử .NET", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No) { try { if (BioBLL.DelChuongTrinh(Convert.ToInt32(gridView_ChuongTrinh.GetRowCellValue(gridView_ChuongTrinh.FocusedRowHandle, "RowIDChuongTrinh").ToString()))) { this.gridControl_ChuongTrinh.DataSource = BioBLL.GetListChuongTrinh(); } else { XtraMessageBox.Show("Xóa danh mục thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { XtraMessageBox.Show("Xóa danh mục thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } }