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);