学習メモです。
using System.Windows.Forms;
namespace count
{
public partial class Form1 : Form
{
//変数の宣言初期値は0
private int _count = 0;
//変わらない定数の値
private const int AAA = 10;
private const string Key = "SDFGHJJ";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//button1_Clickイベントでカウント+1
_count = _count + 1;
}
private void button2_Click(object sender, EventArgs e)
{
//button1_Clickイベントで_countの数値を文字列で表示
MessageBox.Show(_count.ToString());
}
}
}