private void button2_Click(object sender, EventArgs e) { try { if (this.ItemSelect) { DialogResult dr = MessageBox.Show(this, "Are you sure you want received selected Material Requisition?\n\nClick Yes to Receive", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { if ((cmbStore.SelectedValue != null) | (cmbStore.SelectedValue != null)) { objMR.MRReceivedBy = CurrentUser.UserEmp.EmployeeID; objMR.MRStatus = MR.Status.ReceviedGRN; int x = objMRDL.Update_ReceiveGRN(objMR, Convert.ToString(cmbStore.SelectedValue)); Load_MRList(); Load_MRItem(); MessageBox.Show(this, "Successfully Received and GRN", "Successfull", MessageBoxButtons.OK); } } } else { MessageBox.Show(this, "Please Select a Material Requition", "Selection Empty", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(this, "Error occured while Receiving", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }