private void CmdSave_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (txtConPW.Text == "")
         {
             MessageBox.Show("Please Enter the Valied Password! and Enter the same new password in comfirm password box!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtNewPW.Focus();
             txtNewPW.Text = "";
             txtConPW.Text = "";
             return;
         }
         if (txtOldPW.Text == lblOPW.Text && txtConPW.Text == txtNewPW.Text)
         {
             OleDbCommand cmd = new OleDbCommand("Update UserDetails SET Password1='" + txtNewPW.Text + "', PWHint='" + txtPHint.Text
                                                 + "' WHERE UserID='" + txtUserID.Text + "'", con);
             con.Open();
             cmd.ExecuteNonQuery();
             con.Close();
             MessageBox.Show("Record Updated Sucessfully!", "MESSAGE BOX", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CmdExit.Focus();
         }
         else if (txtOldPW.Text != lblOPW.Text && txtConPW.Text != txtNewPW.Text)
         {
             MessageBox.Show("Please Try Again! Please Enter the Correct Old Password! and Enter the same new password in comfirm password box!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtOldPW.Focus();
             txtNewPW.Text = "";
             txtConPW.Text = "";
             txtOldPW.Text = "";
         }
         else if (txtOldPW.Text != lblOPW.Text)
         {
             MessageBox.Show("Please Enter the Correct Old Password!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtOldPW.Focus();
             txtNewPW.Text = "";
             txtOldPW.Text = "";
         }
         else if (txtConPW.Text != txtNewPW.Text)
         {
             MessageBox.Show("Please Enter the Same Password!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtConPW.Focus();
             txtConPW.Text = "";
         }
     }
     catch (Exception x)
     {
         MessageBox.Show("ERROR CODE : CMD-SAV-309-PSW" + "\n" + "\n" + "[Please Note this Error Code and Take a Photo in this More Details." + "\n" + "\n" + "Inform the Error Code and Send this Error Details (Mail or WhatsUP) to Development Team (SRIS)!]" + "\n" + "\n" + "\n" + "MORE DETAILS :- " + "\n" + "\n" + x, "MESSAGE BOX", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MemoryStream ms = new MemoryStream();
                PicImg.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte[] Photo = new byte[ms.Length];
                ms.Position = 0;
                ms.Read(Photo, 0, Photo.Length);
                OleDbCommand cmd = new OleDbCommand("Update UserDetails SET BGColor='" + txtCol.Text
                                                    + "', IImg=@photo WHERE UserID='" + txtUserID.Text + "'", con);
                cmd.Parameters.AddWithValue("@photo", Photo);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                MessageBox.Show("Record Updated Sucessfully!", "MESSAGE BOX", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CmdExit.Focus();
            }
            catch (Exception)
            {
                MessageBox.Show("  Error No:PWCS01 Please Select Valied Profile Photo", "MESSAGE BOX", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }