0% found this document useful (0 votes)
11 views4 pages

Project Source File

The document is a C# source code for a simple calculator application using Windows Forms. It includes methods for number input, basic arithmetic operations, and functionalities like backspace and clear. The calculator processes user input and displays results based on selected operations.

Uploaded by

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

Project Source File

The document is a C# source code for a simple calculator application using Windows Forms. It includes methods for number input, basic arithmetic operations, and functionalities like backspace and clear. The calculator processes user input and displays results based on selected operations.

Uploaded by

mdm565424
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Project Source File:

using static System.Runtime.InteropServices.JavaScript.JSType;

namespace MineWorld

public partial class Form1 : Form

public Form1()

InitializeComponent();

string CalTotal;

decimal numb1;

decimal numb2;

string option;

decimal result;

private void Form1_Load(object sender, EventArgs e)

private void button3_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn3.Text;

private void btn1_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn1.Text;

private void btn2_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn2.Text;

private void btn4_Click(object sender, EventArgs e)

{
TotalBox.Text = TotalBox.Text + btn4.Text;

private void btn5_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn5.Text;

private void btn6_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn6.Text;

private void btn7_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn7.Text;

private void btn8_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn8.Text;

private void btn9_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn9.Text;

private void btn0_Click(object sender, EventArgs e)

TotalBox.Text = TotalBox.Text + btn0.Text;

private void btnDot_Click(object sender, EventArgs e)

if (!TotalBox.Text.Contains("."))

TotalBox.Text = TotalBox.Text + ".";

}
private void btnPlus_Click(object sender, EventArgs e)

if (!string.IsNullOrWhiteSpace(TotalBox.Text))

numb1 = decimal.Parse(TotalBox.Text);

option = "+";

TotalBox.Clear();

private void btnMinus_Click(object sender, EventArgs e)

if (!string.IsNullOrWhiteSpace(TotalBox.Text))

numb1 = decimal.Parse(TotalBox.Text);

option = "-";

TotalBox.Clear();

private void btnMultiplication_Click(object sender, EventArgs e)

if (!string.IsNullOrWhiteSpace(TotalBox.Text))

numb1 = decimal.Parse(TotalBox.Text);

option = "*";

TotalBox.Clear();

private void btnDivision_Click(object sender, EventArgs e)

if (!string.IsNullOrWhiteSpace(TotalBox.Text))

numb1 = decimal.Parse(TotalBox.Text);

option = "/";

TotalBox.Clear();
}

private void btnTotal_Click(object sender, EventArgs e)

numb2 = decimal.Parse(TotalBox.Text);

if (option.Equals("+"))

result = numb1 + numb2;

if (option.Equals("-"))

result = numb1 - numb2;

if (option.Equals("*"))

result = numb1 * numb2;

if (option.Equals("/"))

result = numb1 / numb2;

TotalBox.Text = result.ToString();

private void BackspaceButton_Click(object sender, EventArgs e)

if (!string.IsNullOrEmpty(TotalBox.Text))

TotalBox.Text = TotalBox.Text.Substring(0, TotalBox.Text.Length - 1);

private void btnClear_Click(object sender, EventArgs e)

TotalBox.Clear();

result = (0);

numb1 = (0);

numb2 = (0);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy