Practical 1: Design

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Practical 1

AIM: Create a Window based Application of Arithmetic Calculator in


C#.net.
Design:

Control Name Properties Value

TextBox Name textBox1


TextBox Name textBox2
Name btnAdd
Button Size 50,50
Font-Size 10
Name btnSub
Button Size 50,50
Font-Size 10
Name btnMul
Button Size 50,50
Font-Size 10
Name btnDiv
Button Size 50,50
Font-Size 10
Form1.cs:
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

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

private void btnAdd_Click(object sender, EventArgs e)


{
lblAnswer.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) +
Convert.ToInt32(textBox2.Text));
}

private void btnSub_Click(object sender, EventArgs e)


{
lblAnswer.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) -
Convert.ToInt32(textBox2.Text));
}

private void btnMul_Click(object sender, EventArgs e)


{
lblAnswer.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) *
Convert.ToInt32(textBox2.Text));
}

private void btnDiv_Click(object sender, EventArgs e)


{
lblAnswer.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) /
Convert.ToInt32(textBox2.Text));
}

}
}
Output:

Addition Subtraction

Multiplication Division

You might also like