一、登录按钮
private void button1_Click(object sender, EventArgs e)
{
string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml";
XmlDocument docx = new XmlDocument();
docx.Load(xmlpath);
XmlElement root = docx.DocumentElement;
XmlElement username = (XmlElement)root.GetElementsByTagName("username")[0];
XmlElement pwd = (XmlElement)root.GetElementsByTagName("pwd")[0];
string nametext = username.InnerText.ToString();
string pwdstr = pwd.InnerText.ToString();
if (textBox1.Text == nametext & textBox2.Text == pwdstr)
{
project np = new project();
np.Show();
this.FindForm().Hide();
}
else
{
MessageBox.Show("用户名或密码错误");
textBox1.Text = "";
textBox2.Text = "";
textBox1.Focus();
}
}