Codigo para realizar operaciones basicas en WindowsFormsApplication2

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void bttsuma_Click(object sender, EventArgs e)
        {
            txtresult.Text = Convert.ToString(Convert.ToInt16(txtnum1.Text) + Convert.ToInt16(txtnum2.Text));
        }

        private void bttresta_Click(object sender, EventArgs e)
        {
            txtresult.Text = Convert.ToString(Convert.ToInt16(txtnum1.Text) - Convert.ToInt16(txtnum2.Text));
        }

        private void bttmultiplicacion_Click(object sender, EventArgs e)
        {
            txtresult.Text = Convert.ToString(Convert.ToInt16(txtnum1.Text) * Convert.ToInt16(txtnum2.Text));
        }

        private void bttdivision_Click(object sender, EventArgs e)
        {
            txtresult.Text = Convert.ToString(Convert.ToInt16(txtnum1.Text) / Convert.ToInt16(txtnum2.Text));
        }
    }
 }
 
dcopn :v 
 
 

Comentarios