private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("You need to enter a password"); textBox1.Focus(); return; } DataTable dtte = new DataTable(); dtte = this.tableADTableAdapter.GetDataBy(textBox1.Text); if (dtte.Rows.Count == 0) { MessageBox.Show("Incorrect Password"); // trials = + 1; trials = trials + 1; if (trials == 3) { MessageBox.Show("Shutting down ......"); this.Close(); } // textBox1.Clear(); textBox1.Clear(); textBox1.Focus(); return; } if (textBox2.Text == "") { MessageBox.Show("You need to enter a new password"); textBox2.Focus(); return; } if (textBox3.Text == "") { MessageBox.Show("You need to confirm the new password"); textBox3.Focus(); return; } if (!(textBox2.Text == textBox3.Text)) { MessageBox.Show("Your password and new password don't match"); textBox2.Clear(); textBox3.Clear(); return; } if (textBox2.Text == textBox3.Text) { reportManDataSetTableAdapters.TableADTableAdapter agt = new reportManDataSetTableAdapters.TableADTableAdapter(); agt.UpdateQuery(textBox3.Text); MessageBox.Show("Your password has been changed"); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (!(textBox1.Text == textBox2.Text)) { MessageBox.Show("Your password and new password don't match"); textBox1.Clear(); textBox2.Clear(); return; } if (textBox1.Text == textBox2.Text) { reportManDataSetTableAdapters.TableADTableAdapter agt = new reportManDataSetTableAdapters.TableADTableAdapter(); agt.UpdateQuery(textBox2.Text); MessageBox.Show("Your password has been changed"); this.Close(); } }