Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //this.label1.Text = this.textBox1.Text + comboBox1.SelectedItem + this.textBox2.Text;
            String    str  = comboBox1.GetItemText(comboBox1.SelectedItem);
            Operation oper = OperationFactory.createOperation(str);

            try
            {
                oper.num1 = Convert.ToDouble(this.textBox1.Text);
                oper.num2 = Convert.ToDouble(this.textBox2.Text);
            }catch (Exception)
            {
                throw;
            }
            double result = oper.getResult();

            this.label1.Text = Convert.ToString("result =" + result);
        }