private void textBox2_Leave(object sender, EventArgs e) { UpdateDBlink ul = new UpdateDBlink(); u = ul.getUser(textBox2.Text); ai = ul.getAdmin(textBox2.Text); if (textBox2.Text == u.Name || textBox2.Text == ai.UName) { MessageBox.Show("Invalid Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox2.Text = ""; textBox2.Select(); } }
private void button1_Click(object sender, EventArgs e) { UpdateDBlink ul = new UpdateDBlink(); ai = ul.getAdmin(textBox1.Text); string pass; if (textBox1.Text == ai.UName && ai.UStatus == "Admin") { if (textBox2.Text == ai.Pword) { /* HomeAdmin h = new HomeAdmin(ai); * h.Show(); * this.Visible = false; */ AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; } else { MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { ui = ul.getUser(textBox1.Text); pass = ul.getPassword(textBox1.Text); if (textBox2.Text == pass) { UserHome h = new UserHome(ui); h.Show(); this.Visible = false; } else { MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void textBox1_Leave(object sender, EventArgs e) { if (textBox1.Text == "") { textBox1.Text = "Enter current password Here"; } else { UpdateDBlink ul = new UpdateDBlink(); ai = ul.getAdmin(textBox1.Text); if (textBox1.Text == ai.Pword) { MessageBox.Show("current password matched", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Enter valid current password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox1.Select(); } } }