private void gridControl_ChiCuc_ProcessGridKey(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete && gridView_ChiCuc.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.DelChiCuc(gridView_ChiCuc.GetRowCellValue(gridView_ChiCuc.FocusedRowHandle, "MaChiCuc").ToString())) { this.gridControl_ChiCuc.DataSource = BioBLL.GetListChiCuc(); } 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; } } } }