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:

  • 相关阅读:
    meta标签
    Vue(day8)
    Vue(day7)
    Vue(day6)
    Flex布局
    Vue(day5)
    jquery.data()&jquery.extend()
    Promise对象
    Vue(day4)
    Vue(day3)
  • 原文地址:https://www.cnblogs.com/jizhiqiliao/p/10109361.html
Copyright © 2011-2022 走看看