Ejemplo n.º 1
0
        private void btnShowResult_Click(object sender, EventArgs e)
        {
            Class1 compute = new Class1();

            if (txtFirstNumber.Text == String.Empty)
            {
                MessageBox.Show("First Number cannot be empty");
                txtFirstNumber.Focus();
                return;
            }
            if (txtSecondNumber.Text == String.Empty)
            {
                MessageBox.Show("Second Number cannot be empty");
                txtSecondNumber.Focus();
                return;
            }

            compute.FirstNumber  = Convert.ToDouble(txtFirstNumber.Text);
            compute.SecondNumber = Convert.ToDouble(txtSecondNumber.Text);

            MessageBox.Show("The public result is: " + Convert.ToString(compute.ShowResult()));
            txtSecondNumber.Text = String.Empty;
            txtFirstNumber.Text  = String.Empty;
        }