zoukankan      html  css  js  c++  java
  • Winform使用Settings保留数据

    To achieve the requirement, you can refer to the following steps:

    1.Click "Project" and choose "Setting Properties…", then choose "Settings".

    2.Add new setting in "Settings"

    3.Try the following code:

    private void Accept_Click(object sender, EventArgs e)
    {
        Properties.Settings.Default.cb = checkBox1.Checked;
        Properties.Settings.Default.str = textBox1.Text;
        Properties.Settings.Default.Save();
    }
    
    private void LoadSetting_Click(object sender, EventArgs e)
    {
        checkBox1.Checked = Properties.Settings.Default.cb;
        textBox1.Text = Properties.Settings.Default.str;
    }
    
    private void Cancel_Click(object sender, EventArgs e)
    {
        Properties.Settings.Default.cb = false;
        Properties.Settings.Default.str = "";
        Properties.Settings.Default.Save();
    }

    Result:

  • 相关阅读:
    spark 脚本示例
    R树的应用
    将博客搬至CSDN
    select
    注册页面的验证码的实现
    web项目.注册及登陆
    eclipse web 项目中遇到的问题总结
    Apache与Tomcat
    关于MVC整理
    JDBC
  • 原文地址:https://www.cnblogs.com/jizhiqiliao/p/10109361.html
Copyright © 2011-2022 走看看