Sunday, 21 July 2013

Simple Calculater in .net with coding working By:Tanuj Kumar

Simple Calculater in .net with coding working

Simple Calculater in .net with coding

Problem 4:-->
Windowform4:
Simple Calculater in .net with coding working

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace WindowsApplication5
{
    public partial class Form1 : Form
    {
        bool plus = false;
        bool minus = false;
        bool multiply = false;
        bool divide = false;
        public Form1()
        {
            InitializeComponent();
        }
        ArrayList.
        private void button1_Click(object sender, EventArgs e)
        {

            calci.Text = calci.Text + "1";


        }

        private void button2_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "2";

        }

        private void button3_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "3";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "4";
        }

        private void button5_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "5";
        }

        private void button6_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "6";
        }

        private void button7_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "7";

        }

        private void button8_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "8";
        }

        private void button9_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "9";
        }

        private void button10_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "0";

        }


        private void button16_Click(object sender, EventArgs e)
        {
            calci.Text = "";
        }

        private void button11_Click(object sender, EventArgs e)
        {
            if (calci.Text == "")
            {
                return;
            }
            else
            {
                plus = true;
                calci.Tag = calci.Text;
                calci.Text = "";
            }

        }

        private void button15_Click(object sender, EventArgs e)
        {
            if (plus)
            {
                decimal dec = Convert.ToDecimal(calci.Tag) + Convert.ToDecimal(calci.Text);
                calci.Text = dec.ToString();
            }
            else if (minus)
            {
                decimal dec = Convert.ToDecimal(calci.Tag) - Convert.ToDecimal(calci.Text);
                calci.Text = dec.ToString();
            }
            else if (multiply)
            {
                decimal dec = Convert.ToDecimal(calci.Tag) * Convert.ToDecimal(calci.Text);
                calci.Text = dec.ToString();
            }
            else if (divide)
            {
                decimal dec = Convert.ToDecimal(calci.Tag) / Convert.ToDecimal(calci.Text);
                calci.Text = dec.ToString();
            }
            return;
        }



        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button17_Click(object sender, EventArgs e)
        {
            if (calci.Text.Contains("."))
            {
                return;
            }
            else
            {
                calci.Text = calci.Text + ".";
            }
        }

        private void button12_Click(object sender, EventArgs e)
        {
            if (calci.Text == "")
            {
                return;
            }
            else
            {
                minus = true;
                calci.Tag = calci.Text;
                calci.Text = "";
            }
        }

        private void button13_Click(object sender, EventArgs e)
        {
            if (calci.Text == "")
            {
                return;
            }
            else
            {
                multiply = true;
                calci.Tag = calci.Text;
                calci.Text = "";
            }
        }

        private void button14_Click(object sender, EventArgs e)
        {
            if (calci.Text == "")
            {
                return;
            }
            else
            {
                divide = true;
                calci.Tag = calci.Text;
                calci.Text = "";
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {

        }

        private void button15_Click_1(object sender, EventArgs e)
        {

        }

        private void button14_Click_1(object sender, EventArgs e)
        {

        }

        private void button13_Click_1(object sender, EventArgs e)
        {

        }

        private void button12_Click_1(object sender, EventArgs e)
        {

        }

        private void button11_Click_1(object sender, EventArgs e)
        {

        }

        private void button10_Click_1(object sender, EventArgs e)
        {

        }

        private void button9_Click_1(object sender, EventArgs e)
        {

        }

        private void button8_Click_1(object sender, EventArgs e)
        {

        }

        private void button7_Click_1(object sender, EventArgs e)
        {

        }

        private void button6_Click_1(object sender, EventArgs e)
        {

        }

        private void button5_Click_1(object sender, EventArgs e)
        {

        }

        private void button4_Click_1(object sender, EventArgs e)
        {

        }

        private void button3_Click_1(object sender, EventArgs e)
        {

        }

        private void button2_Click_1(object sender, EventArgs e)
        {

        }

        private void calci_TextChanged(object sender, EventArgs e)
        {

        }
    }
}





Posted By:Tanuj Kumar 
On:Shareyourconscience




0 comments:

Post a Comment