Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "admin" && textBox2.Text == "admin")
     {
         mainform MF = new mainform();
         MF.Show();
         Hide();
     }
     else
     {
         MessageBox.Show("账号密码有误!");
         textBox1.Text = "";
         textBox2.Text = "";
         textBox1.Focus();
     }
 }
Exemple #2
0
 private void textBox2_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (textBox1.Text == "admin" && textBox2.Text == "admin")
         {
             mainform MF = new mainform();
             MF.Show();
             Hide();
         }
         else
         {
             MessageBox.Show("账号密码有误!");
             textBox1.Text = "";
             textBox2.Text = "";
             textBox1.Focus();
         }
     }
 }