使TextBox能够记住上一次的输入文本,简单设置即可实现,简单好用:
1)项目 右键–> 属性–>设置 --> 添加名称及对应的值
private void TestForm_Load(object sender, EventArgs e)
{
textBox1.Text = Properties.Settings.Default.diamLimit;
textBox2.Text = Properties.Settings.Default.lenLimit;
}
3)记忆TextBox中输入的值
首先:为Form窗体添加事件FormClose
private void TestForm_FormClose(object sender, FormClosedEventArgs e)
{
Properties.Settings.Default.diamLimit = textBox1.Text;
Properties.Settings.Default.lenLimit = textBox2.Text;
Properties.Settings.Default.Save();
}
这样就可以记忆上次运行的内容了。
注意:需要添加引用:using **命名空间.Properties;
因篇幅问题不能全部显示,请点此查看更多更全内容