Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            double n1, n2;

            try
            {
                n1 = Convert.ToDouble(txts1.Text);
                n2 = Convert.ToDouble(txts2.Text);

                sumar objS = new sumar();
                objS.Setnum1 = n1;
                objS.Setnum2 = n2;

                if (!objS.Calcular())
                {
                    MessageBox.Show(objS.Geterror);
                    return;
                }
                else
                {
                    txttol.Text = objS.Getresult.ToString();
                }
            }catch (Exception X)
            {
                MessageBox.Show(X.Message);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            sumar su1 = new sumar();

            su1.Ingresar();
            su1.Sumar();
            su1.Imprimir();
            Console.ReadLine();
        }
        public CalculadoraFrame()
        {
            InitializeComponent();

            Button Btn1 = new Button();

            Btn1.Text     = "Abrir";
            Btn1.Name     = "BtnAbrir";
            Btn1.Image    = AppAdivinanza.Properties.Resources.Salvar;
            Btn1.Location = new Point(400, 300);
            Btn1.Click   += HolaMundo;
            delSumar      = Calculadora.Sumar;


            this.Controls.Add(Btn1);
        }