LoginSignup
0
0

More than 1 year has passed since last update.

Visual Studio の使い方

Last updated at Posted at 2022-09-01

AWS の EC2 の Windows Server 2019 で
Visual Studio 2022 を使ってみました。

次のようなプログラムを作成しました。
image.png

Label を 2個
Button を 4個
TextBox を 1個
配置します。

Visual Studio 2022 で編集

Label や Button をクリックすると、TextBox の表記が変わります。

image.png

プログラム

Form1.cs
namespace WinFormsApp_sep01
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "4 seasons";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "Spring";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "Summer";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text = "Autumn";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            textBox1.Text = "Winter";
        }

        private void label2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
        }
    }
}
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