private void Button1_Click(object sender, EventArgs e) { if (ID == 0) { MessageBox.Show("No Mp Selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrWhiteSpace(txtFirstname.Text) || string.IsNullOrWhiteSpace(txtSecondname.Text) || cmbBelief.SelectedIndex == 0 || cmbResidence.SelectedIndex == 0) { MessageBox.Show("All fields are required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { clsModule.UpdateMP(ID, txtFirstname.Text, txtSecondname.Text, int.Parse(cmbBelief.SelectedValue.ToString()), int.Parse(cmbResidence.SelectedValue.ToString())); if (clsModule.Status > 0) { MessageBox.Show("Mp Updated Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } else { MessageBox.Show("Oops! Something", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { MessageBox.Show("Invalid options Selected Belief or Residence ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }