Exemple #1
0
        private void btnRestar_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != string.Empty) //diferente a cadena de texto vacio
            {
                valor1 = Convert.ToDouble(textBox1.Text);
            }

            if (textBox2.Text != string.Empty)
            {
                valor2 = Convert.ToDouble(textBox2.Text);
            }

            textBox3.Text = calculos.resta(valor1, valor2).ToString();
        }
        private void btnRestar_Click(object sender, EventArgs e)
        {
            clsCalculos calculos = new clsCalculos();

            try
            {
                if (ValidacionCampoOK1("Restar"))
                {
                    //valor1 = Convert.ToDouble(textBox1.Text);
                    //valor2 = Convert.ToDouble(textBox2.Text);
                    //textBox3.Text = calculos.resta(valor1, valor2).ToString();

                    textBox3.Text = calculos.resta(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)).ToString();
                }
            }
            catch (Exception er)
            {
                MessageBox.Show("Erroor: " + er.Message);
            }
        }