考虑对我的登录表单进行一些修改,而不是将密码作为变量放入我的代码中,有没有一种方法可以加密它并将其存储在文本文件中,这样每次我想登录时,它都会比较来自文本文件??
private void button1_Click(object sender, EventArgs e)
{
string username1 = "Richard";
string password1 = "Peugeot";
if (this.textBox1.Text == username1 && this.textBox2.Text == password1)
{
MessageBox.Show("Welcome Richard!", "Welcome");
Form1 frm = new Form1();
frm.Show();
this.Hide();
}
else
MessageBox.Show("Incorrect username or password", "Bad credentials");
}