TextBoxに入力したメールアドレスを終了時に保存して次回の起動時にTextBoxに復元させたいのでがうまくいきません。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppImportantMessage
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//button1(メールアドレスを登録)をクリックするとForm2に遷移する。 private void button1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.Show(); } private void Form1_Load(object sender, EventArgs e) { this.textBoxMailaddress.Text = Properties.Settings.Default.mailaddress; } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Properties.Settings.Default.mailaddress = this.textBoxMailaddress.Text; Properties.Settings.Default.Save(); } /*
private void buttonClose_Click(object sender, EventArgs e)
{
Application.Exit(); //アプリ終了(※Form1_FormClosing() も呼び出される)
}
*/
}
}
回答1件
あなたの回答
tips
プレビュー