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

New Topic/Question
This topic is locked


MultiQuote











|