private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "prani" && textBox2.Text.Trim() == "pppp")
{
MessageBox.Show("u have succesfully logedin");
}
else
{
label3.Visible = true;
label3.Text = "Incorrect username or password please try again";
//MessageBox.Show("incorrect username or password Please try again");
textBox1.Clear();
textBox2.Clear();
textBox2.Focus();
}
}
i tried this to validate the text box......this is a simple login form.
else block is always being executed even if i give the correct password and username.
make me clear with this....tell me the process to validate the text in text box.
private void button1_Click(object sender, EventArgs e)
02 {
03 if (textBox1.Text == "prani" && textBox2.Text == "pppp")
04 {
05 MessageBox.Show("u have succesfully logedin");
06 }
07 else
08 {
09 label3.Visible = true;
10 label3.Text = "Incorrect username or password please try again";
11 //MessageBox.Show("incorrect username or password Please try again");
12 textBox1.Clear();
13 textBox2.Clear();
14 textBox2.Focus();
15 }
16 }
not working even for this code alse

New Topic/Question
Reply



MultiQuote





|