sábado, 18 de octubre de 2014

Calculadora sencilla


double total1 = 0;
        private void btnsuma_Click(object sender, EventArgs e)
        {
            total1 = total1 + double.Parse(txtDisplay.Text);
            txtDisplay.Clear();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void btn1_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnone.Text;
        }

        private void btntwo_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btntwo.Text;
        }

        private void btnthree_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnthree.Text;
        }

        private void btnfour_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnfour.Text;
        }

        private void btnfive_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnfive.Text;
        }

        private void btnsix_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnsix.Text;
        }

        private void btnseven_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnseven.Text;
        }

        private void btneight_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btneight.Text;
        }

        private void btnnine_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnnine.Text;
        }

        private void btnzero_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnzero.Text;
        }
        Double total2 = 0;
        private void btniguals_Click(object sender, EventArgs e)
        {
            total2= total1+double.Parse(txtDisplay.Text);
            txtDisplay.Text = total2.ToString();
            total1 = 0;
        }

        private void btnclear_Click(object sender, EventArgs e)
        {
            txtDisplay.Clear();
        }

        private void Close_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnpoint_Click(object sender, EventArgs e)
        {
            txtDisplay.Text = txtDisplay.Text + btnpoint.Text;
        }
    }
}


No hay comentarios:

Publicar un comentario