private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int iGroupId = Convert.ToInt32(CommFun.IsNullCheck(grdOCView.GetFocusedRowCellValue("GroupId"), CommFun.datatypes.vartypenumeric)); bool bAns = false; bAns = UnitDirBL.FoundOCG(iGroupId); if (bAns == true) { MessageBox.Show("Do not Delete, Group Already Used"); return; } DialogResult result1 = MessageBox.Show("Are you sure", "Group Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result1 == DialogResult.Yes) { UnitDirBL.DeleteOCG(iGroupId); grdOCView.DeleteSelectedRows(); } }