private void btnDelete_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(this, "Are you sure to delete selected record?", clsGlobal.pstrAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { using (clsConnection oConn = new clsConnection()) { frmMain.setLoadDialog(true, "Deleting data..."); tbm_car oObject = new tbm_car(); oConn.Open(); oObject.Koneksi = oConn.Conn; oObject.carid = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCarId)); oObject.opedit = clsGlobal.strUserName; oObject.pcedit = SystemInformation.ComputerName; oObject.SoftDelete(); oObject = null; gridViewData.DeleteSelectedRows(); XtraMessageBox.Show(this, "Record Successfully Deleted", clsGlobal.pstrAppName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (NpgsqlException ex) { } catch (Exception ex) { ////clsGlobal.generateErrMessageAndSendmail(ex, false); } finally { frmMain.setLoadDialog(false, ""); } } }