1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| private void button2_Click_1(object sender, EventArgs e)
{
errorProvider1.Dispose();
errorProvider2.Dispose();
if (textBox1.Text.Length == 0)
{
errorProvider1.SetError(textBox1, "user vide !!!");
return;
}
if (textBox2.Text.Length == 0)
{
errorProvider2.SetError(textBox2, "password vide !!!");
return;
}
try
{
if (textBox1.Text == "admin")
{
if (textBox2.Text == "password")
{
button2.Visible = true;
Form2 f2 = new Form2();
f2.Show();
this.Hide();
}
else
{
errorProvider1.SetError(textBox2, "password érroné");
return;
}
}
else
{
errorProvider1.SetError(textBox1, "user inconnu !!!");
return;
}
}
catch (FormatException ex)
{
}
} |
Partager