2 Replies - 837 Views - Last Post: 29 September 2012 - 01:07 PM Rate Topic: -----

#1 Naran kutty  Icon User is offline

  • New D.I.C Head

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

how to differentiate the Hex, Bin, Dec using Radio button

Posted 29 September 2012 - 03:14 AM

Attached File  akjf.txt (5.64K)
Number of downloads: 45Attached File  akjf.txt (5.64K)
Number of downloads: 45Now I click on Bin radio button remaining numbers are hide only 0 and 1 should be work in operations and click on hex, hex values work in operations like in windows 7 programmer calci

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

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

        }




MOD EDIT: Moved code into post. Don't make people download text files; put your code IN your post.

This post has been edited by JackOfAllTrades: 29 September 2012 - 03:52 AM


Is This A Good Question/Topic? 0
  • +

Replies To: how to differentiate the Hex, Bin, Dec using Radio button

#2 zeeshanef  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 74
  • Joined: 14-April 12

Re: how to differentiate the Hex, Bin, Dec using Radio button

Posted 29 September 2012 - 08:47 AM

you can use Click or CheckChanged event of RadioButtons and then call the function to disable or enable the Buttons, as choice of Radio button.
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,846
  • Joined: 02-June 10

Re: how to differentiate the Hex, Bin, Dec using Radio button

Posted 29 September 2012 - 01:07 PM

There is not enough information in your post for us to understand what you are doing, what you want, or what trouble you are having. Maybe you could try a more detailed explanation and run it through translate.google.com because most of your post is just gibberish.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1