C# Windows Application Calculator (ADVANCED)

05/11/2014 14:43 v1suaL#1
Don't forget to thank me. :bandit::bandit::bandit:

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
/*
 * Controls needed:
 * 18 buttons button 16 and 17 must be del and clear and button 15 MUST be =
 * 1 Textbox (read only true)
 * Mouse enter (buttons) to hoverON
 * Mouse leave (buttons) to hoverOFF
 * Button click (buttons) to buttonCheck
 * Button click(-+/x) to setOperator
*/
namespace Calculator
{
    public partial class Form1 : Form
    {
        int value1 = 0; //Declare old value
        int opValue = 0; //Declare operation value
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            //nothing has to be done here
        }
        //making a new void for the controls
        private void ButtonCheck(Object sender, EventArgs e)
        {
            
            if (display.MaxLength <= 20) //do this if maxlength is smaller then or equal to 20
            {
            if(display.Text == "Math Error"){ // if the math error is known clear the display
                display.Clear();
            }
            display.MaxLength += 1; //increase max length
            Button getSender = (Button)sender; //declare get sender with the button clicked options
            display.Text = display.Text + getSender.Text; //add the number in the screen
            }
        }
        private void button15_Click(object sender, EventArgs e)
        {
            int answer = 0;
            if(opValue == 0){ //if operator isn't set
                display.Text = "Math Error";
            }
            else if(display.Text == "") //if values isn't set
            {
                display.Text = "Math Error";
            }
            else if (display.Text == "Math Error") //if math error is shown
            {
                display.Text = "Math Error";
            } else if(opValue == 1){
                // - operator
                answer = value1 - Convert.ToInt32(display.Text); //calculate with -
                display.Text = answer.ToString(); //show the answer
            } else if(opValue == 2){ 
                // + operator
                answer = value1 + Convert.ToInt32(display.Text); //calculate with +
                display.Text = answer.ToString(); //show the answer
            } else if (opValue == 3){ 
                // / operator
                answer = value1 / Convert.ToInt32(display.Text); //calculate with /
                display.Text = answer.ToString(); //show the answer
            }
            else if (opValue == 4)
            {
                // * operator
                answer = value1 * Convert.ToInt32(display.Text); //calculate with *
                display.Text = answer.ToString(); //show the answer
            }
            else if (opValue == 5)
            {
                // ^ operator
                answer = Convert.ToInt32(System.Math.Pow(Convert.ToDouble(value1), Convert.ToDouble(display.Text))); //calculate with ^
                display.Text = answer.ToString(); //show the answer
            }
            answer = 0; //reset answer
            opValue = 0; //reset operator value
            value1 = 0; //reset old value
        }
        private void setOperator(Object sender, EventArgs e)
        {
            Button getSender = (Button)sender;
            if (getSender.Text == "-") //get -
            {
                opValue = 1; //set operator value
            }
            else if (getSender.Text == "+") //get +
            {
                opValue = 2; //set operator value
            }
            else if (getSender.Text == "/") //get /
            {
                opValue = 3; //set operator value
            }
            else if (getSender.Text == "x") //get x
            {
                opValue = 4; //set operator value
            }
            else if (getSender.Text == "^") //get ^
            {
                opValue = 5; //set operator value
            }
            else
            {
                display.Text = "Operator Error"; //show error
            }
            if (display.Text != "") //if display is empty
            {
                if (display.Text == "Math Error") //if match error shows
                {
                    display.Text = "Math Error"; //display math error
                }
                else
                {
                    value1 = Convert.ToInt32(display.Text); //set old value to new text
                    display.Clear(); //clear the display
                }
            }
            else
            {
                display.Text = "Math Error"; //display math error
            }
            
        }
        //del(delete) button
        private void button16_Click(object sender, EventArgs e)
        {
            if (display.Text.Length >= 1) //if current length is greater than or equal to 1
            {
                display.Text = display.Text.Remove(display.Text.Length - 1); //remove last character
            }
        }
        
        //c(clear) button
        private void button17_Click(object sender, EventArgs e)
        {
            display.Clear(); //clear the button
            value1 = 0;//reset old value
            opValue = 0;//reset operator value
        }
        //BUTTON HOVER\\
        //On mouse entering (over) a button
        private void button_HoverON(object sender, EventArgs e)
        {
            Button getButton = (Button)sender; //get button options
            getButton.BackColor = Color.LightGray; //set button background colour
        }
        //On mouse leaving (out) a button
        private void button_HoverOFF(object sender, EventArgs e)
        {
            Button getButton = (Button)sender; //get button options
            getButton.BackColor = Color.FromName("Control"); //set button background to default button colour
        }
    }
05/11/2014 17:55 VisionEP1#2
Thank u for posting in the wrong section?
Thank u for posting work of 2min coding?
Thank u for this code?
No thank u.
05/18/2014 17:13 x]vIrus[x#3
and thank you for distributing crappy written code, i hope no one will ever use this as a reference