示例#1
0
        private void btnSumar_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.suma(valor1, valor2).ToString();
        }
        private void btnSumar_Click(object sender, EventArgs e)
        {
            clsCalculos calculos = new clsCalculos();

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