private void btnChangePW_Click(object sender, EventArgs e) { if (!f) { if (txtUsername2.Text != "" && txtOldPW.Text != "" && txtReNewPW.Text != "" && txtNewPW.Text != "") { int k = db.SignIn(txtUsername2.Text, txtOldPW.Text, ref error); if (k != 0) { if (txtNewPW.Text == txtReNewPW.Text) { try { db.ChangePassword(txtUsername2.Text, txtOldPW.Text, txtNewPW.Text, ref error); MessageBox.Show("Complete"); } catch { MessageBox.Show("SQL error: " + error); } } else { MessageBox.Show("Your new password and re-enter new password are not the same"); } } else { MessageBox.Show("Username or Old password is wrong!"); } } else { MessageBox.Show("Please enter all information", "", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); } } }