0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C#変数と定数の宣言、カウント

Posted at

学習メモです。

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());
        }
    }
}


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?