Hex, Bin, Dec Calculator

Page 1 of 1

4 Replies - 487 Views - Last Post: 02 October 2012 - 02:37 AM

#1 Naran kutty  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-September 12

Hex, Bin, Dec Calculator

Posted 01 October 2012 - 12:38 AM

private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.RadioButton radioButton3;
        private System.Windows.Forms.RadioButton radioButton2;
        private System.Windows.Forms.RadioButton radioButton1;
        private System.Windows.Forms.Button btnbsp;
        private System.Windows.Forms.TextBox calci;
        private System.Windows.Forms.Button btnD;
        private System.Windows.Forms.Button btnE;
        private System.Windows.Forms.Button btnF;
        private System.Windows.Forms.Button btnA;
        private System.Windows.Forms.Button btnB;
        private System.Windows.Forms.Button btnC;
        private System.Windows.Forms.Button btn1;
        private System.Windows.Forms.Button btn2;
        private System.Windows.Forms.Button btn3;
        private System.Windows.Forms.Button btn4;
        private System.Windows.Forms.Button btn5;
        private System.Windows.Forms.Button btn6;
        private System.Windows.Forms.Button btn7;
        private System.Windows.Forms.Button btn9;
        private System.Windows.Forms.Button btndot;
        private System.Windows.Forms.Button btn0;
        private System.Windows.Forms.Button btneql;
        private System.Windows.Forms.Button btnclr;
        private System.Windows.Forms.Button btn8;
        private System.Windows.Forms.Button btnsub;
        private System.Windows.Forms.Button btnmul;
        private System.Windows.Forms.Button btnadd;
        private System.Windows.Forms.Button btndiv;
        
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 WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 bool plus = false;
        bool minus = false;
        bool multiply = false;
        bool divide = false;
        private void btn1_Click(object sender, EventArgs e)
        {
            calci.Text = calci.Text + "1";
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        private void btneql_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 btnclr_Click(object sender, EventArgs e)
        {
            calci.Text = "";
        }

        private void btnbsp_Click(object sender, EventArgs e)
        {
            if (calci.Text.Length > 0)  

         calci.Text = calci.Text.Remove(calci.Text.Length - 1); 

        }


Im doing project in my training that is a calculator using hexa decimal, binary, decimal using radio button to select each I getting only decimal like basic calculator but how to get binary and hexa decimal will done please tell any body

Is This A Good Question/Topic? 0
  • +

Replies To: Hex, Bin, Dec Calculator

#2 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1376
  • View blog
  • Posts: 10,951
  • Joined: 06-February 08

Re: Hex, Bin, Dec Calculator

Posted 01 October 2012 - 01:32 AM

*
POPULAR

masturbate furiously until it starts working.

This post has been edited by gabehabe: 01 October 2012 - 01:33 AM

Was This Post Helpful? 8
  • +
  • -

#3 strawhat89  Icon User is offline

  • The Watcher Outside Your Window


Reputation: 247
  • View blog
  • Posts: 1,795
  • Joined: 11-July 11

Re: Hex, Bin, Dec Calculator

Posted 01 October 2012 - 02:02 AM

I wish I could upvote the above post more than once. :lol:

Everytime I see a post in the Lounge by a person with an Indian sounding name, I wish that its not a 'please help me with my project question'. Sadly, very rarely does it come true.
Was This Post Helpful? 1
  • +
  • -

#4 aresh  Icon User is offline

  • It's a 16-Bit World!
  • member icon

Reputation: 273
  • View blog
  • Posts: 4,089
  • Joined: 08-January 12

Re: Hex, Bin, Dec Calculator

Posted 02 October 2012 - 01:16 AM

Even without questions, Indians start great topics.

And how come nobody moved it to some forum or closed it? Strange.
Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5951
  • View blog
  • Posts: 23,214
  • Joined: 23-August 08

Re: Hex, Bin, Dec Calculator

Posted 02 October 2012 - 02:37 AM

You already have a topic on this, so I'll shut this down before more abuse is heaped upon you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1