0% found this document useful (0 votes)
29 views3 pages

Practical 1: Design

The document describes the design and code for a basic arithmetic calculator application created in C# .NET. It includes two text boxes for user input, and buttons for addition, subtraction, multiplication, and division that perform the corresponding calculations on the input values and display the result. The code handles the button click events to retrieve the values, perform the math, and update the answer label.

Uploaded by

jay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Practical 1: Design

The document describes the design and code for a basic arithmetic calculator application created in C# .NET. It includes two text boxes for user input, and buttons for addition, subtraction, multiplication, and division that perform the corresponding calculations on the input values and display the result. The code handles the button click events to retrieve the values, perform the math, and update the answer label.

Uploaded by

jay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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