a12*_*773 1 c# settings winforms
我尝试使用此代码加载和保存设置但是当我关闭并重新运行程序时未加载的设置.默认情况下,设置为空白.我没有错误.
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;
}
Run Code Online (Sandbox Code Playgroud)
尝试
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Username = txtUsername.Text;
Properties.Settings.Default.Password = txtPassword.Text;
Properties.Settings.Default.Save();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3586 次 |
| 最近记录: |