sábado, 5 de julio de 2008

codigo para calculadora

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
{
int n1 = 0;
public Form1()
{
InitializeComponent();
}

private void button9_Click(object sender, EventArgs e)
{

}

private void Form1_Load(object sender, EventArgs e)
{
}

private void button9_Click_1(object sender, EventArgs e)
{
if (textBox1.Text == "0")
textBox1.Text = "9";
else
textBox1.Text = textBox1.Text + "9";
}

private void button8_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
textBox1.Text = "8";
else
textBox1.Text = textBox1.Text + "8";
}

private void button4_Click(object sender, EventArgs e)
{

}

private void button10_Click(object sender, EventArgs e)
{

}

private void button11_Click(object sender, EventArgs e)
{

n1 = Convert.ToInt16(textBox1.Text);
textBox1.Text = "0";

}

private void button16_Click(object sender, EventArgs e)
{
int n2 = 0;
int resultado = 0;
n2 = Convert.ToInt16(textBox1.Text);
resultado = n1 + n2;
textBox1.Text = Convert.ToString(resultado);
}
}
}

No hay comentarios: