The TextBox control saves the last input

Time:2020-9-4

This article is to refer to C ා how to let WinForm program input text box to retain the last input, again thank you
Write it again here, in order to save it, so that you can find it quickly next time
1. Setting the configuration file for the txtbox control
在这里插入图片描述
2、
Select text to create a new one
在这里插入图片描述
3. Enter the custom name and select user
在这里插入图片描述
5、
Sadname is the name defined in the previous step

private Settings settings = new Settings();
  private void Form1_Load(object sender, EventArgs e)
        {
        	 txtBox1.Text = settings.sdaname;
        }
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
           settings.sdaname  = txtBox1.Tex;
            settings.Save();
        }

6. If there are multiple txtbox controls in the project, each control needs to set a configuration file, and the configuration file name of each control cannot be the same