コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                account at  = new account();
                int     a   = int.Parse(textBox1.Text.Trim());
                int     b   = int.Parse(textBox2.Text.Trim());
                string  str = comboBox1.Text;
                switch (str)
                {
                case "加":
                    textBox3.Text = at.add(a, b).ToString();
                    break;

                case "减":
                    textBox3.Text = at.subtraction(a, b).ToString();
                    break;

                case "乘":
                    textBox3.Text = at.mulitiplication(a, b).ToString();
                    break;

                case "除":
                    textBox3.Text = at.division(a, b).ToString();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }