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

Recommended Today

Viver hoje (live in the present)

Se tiver que amar, ame hoje. Se tiver que sorrir, sorria hoje. Se tiver que chorar, chore hoje. Pois o importante é viver hoje. O ontem já foi e o amanhã talvez não venha.If you can love, please love today.If you can smile, please smile today.If you want to cry, cry today.The important thing is […]