我尝试使用此代码加载和保存设置,但是当我关闭并重新运行程序时,设置未加载。默认情况下,设置为空白。我没有错误。
private void Form1_Load(object sender, EventArgs e)
{
txtUsername.Text = Properties.Settings.Default.Username;
txtPassword.Text = Properties.Settings.Default.Password;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Username = txtUsername.Text;
Properties.Settings.Default.Password = txtPassword.Text;
}