Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Calculator : Form
- {
- public Calculator()
- {
- InitializeComponent();
- }
- private bool plusbool = false;
- private bool minbool =false;
- private bool keerbool =false;
- private bool deelbool =false;
- private bool Nummer0bool = false;
- private bool ButtonDotbool = false;
- double invoer1double;
- double invoer2double;
- double antwoorddouble;
- private void Nummer1_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 1;
- antwoord.Text = "";
- }
- private void Nummer2_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 2;
- antwoord.Text = "";
- }
- private void Nummer3_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 3;
- antwoord.Text = "";
- }
- private void Nummer4_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 4;
- antwoord.Text = "";
- }
- private void Nummer5_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 5;
- antwoord.Text = "";
- }
- private void Nummer6_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 6;
- antwoord.Text = "";
- }
- private void Nummer7_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 7;
- antwoord.Text = "";
- }
- private void Nummer8_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 8;
- antwoord.Text = "";
- }
- private void Nummer9_Click(object sender, EventArgs e)
- {
- invoer1.Text = invoer1.Text + 9;
- antwoord.Text = "";
- }
- private void Nummer0_Click(object sender, EventArgs e)
- {
- if (invoer1.Text == "") { }
- else
- {
- invoer1.Text = invoer1.Text + 0;
- antwoord.Text = "";
- }
- }
- private void buttonDot_Click(object sender, EventArgs e)
- {
- if (Nummer0bool == true) { }
- if (ButtonDotbool == true) { }
- else
- {
- if (Nummer0bool == true)
- {
- if (ButtonDotbool == true) { }
- else
- {
- invoer1.Text = invoer1.Text + ".";
- antwoord.Text = "";
- ButtonDotbool = true;
- }
- }
- else
- {
- if (ButtonDotbool == true) { }
- else
- {
- invoer1.Text = invoer1.Text + "0";
- antwoord.Text = "";
- ButtonDotbool = true;
- }
- {
- invoer1.Text = invoer1.Text + ".";
- antwoord.Text = "";
- }
- }
- }
- }
- private void buttonPlus_Click(object sender, EventArgs e)
- {
- invoer2.Text = invoer1.Text;
- invoer2double = double.Parse(invoer2.Text);
- invoer1.Text = "";
- plusbool = true;
- minbool = false;
- keerbool = false;
- deelbool = false;
- }
- private void buttonMinus_Click(object sender, EventArgs e)
- {
- invoer2.Text = invoer1.Text;
- invoer2double = double.Parse(invoer2.Text);
- invoer1.Text = "";
- plusbool = false;
- minbool = true;
- keerbool = false;
- deelbool = false;
- }
- private void buttonTimes_Click(object sender, EventArgs e)
- {
- invoer2.Text = invoer1.Text;
- invoer2double = double.Parse(invoer2.Text);
- invoer1.Text = "";
- plusbool = false;
- minbool = false;
- keerbool = true;
- deelbool = false;
- }
- private void buttonDivide_Click(object sender, EventArgs e)
- {
- invoer2.Text = invoer1.Text;
- invoer2double = double.Parse(invoer2.Text);
- invoer1.Text = "";
- plusbool = false;
- minbool = false;
- keerbool = false;
- deelbool = true;
- }
- private void buttonResult_Click(object sender, EventArgs e)
- {
- invoer1double = double.Parse(invoer1.Text);
- if (plusbool == true) antwoorddouble = invoer1double + invoer2double;
- if (minbool == true) antwoorddouble = invoer1double - invoer2double;
- if (keerbool == true) antwoorddouble = invoer1double * invoer2double;
- if (deelbool == true) antwoorddouble = invoer1double / invoer2double;
- antwoord.Text = antwoorddouble.ToString();
- invoer1.Text = "";
- invoer2.Text = "";
- plusbool = false;
- minbool = false;
- keerbool = false;
- deelbool = false;
- }
- private void buttonClearAll_Click(object sender, EventArgs e)
- {
- }
- private void Invoer1_TextChanged(object sender, EventArgs e)
- {
- }
- private void Invoer2_TextChanged(object sender, EventArgs e)
- {
- }
- private void Antwoord_TextChanged(object sender, EventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment