Monday, 8 April 2013

Make simple calculator in c# windows form application




namespace calculator
{
publicpartialclassForm1 : Form
    {
public Form1()
        {
InitializeComponent();
        }

privatevoid button5_Click(object sender, EventArgs e)
        {
            Close();
        }

privatevoid button1_Click(object sender, EventArgs e)
        {
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
            textBox3.Text = Convert.ToString(a + b);
        }

privatevoid button2_Click(object sender, EventArgs e)
        {
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
            textBox3.Text = Convert.ToString(a - b);
        }

privatevoid button3_Click(object sender, EventArgs e)
        {
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
            textBox3.Text = Convert.ToString(a * b);
        }

privatevoid button4_Click(object sender, EventArgs e)
        {
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
            textBox3.Text = Convert.ToString(a / b);
        }

privatevoid button6_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
        }

privatevoid button7_Click(object sender, EventArgs e)
        {
            textBox2.Clear();
        }

privatevoid label1_Click(object sender, EventArgs e)
        {

        }
    }
}


c# windows form application

0 comments:

Post a Comment