pothana rajesh

pothana rajesh

  • NA
  • 30
  • 938

plz send dissmal value code in c#.net

Sep 23 2014 1:18 PM
I have one small qustion.. plz ans me..
 this is my simple caluclater code..
i have dismal value code..
plz send code plz.. 
private void butn1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "1";
a = 1;
}
else
{
a = a * 10 + 1;
textBox1.Text = a.ToString();
}
}
private void butn2_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "2";
a = 2;
}
else
{
a = a * 10 + 2;
textBox1.Text = a.ToString();
}
}
private void butn3_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "3";
a = 3;
}
else
{
a = a * 10 + 3;
textBox1.Text = a.ToString();
}
}
private void butn4_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "4";
a = 4;
}
else
{
a = a * 10 + 4;
textBox1.Text = a.ToString();
}
}
private void butn5_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "5";
a = 5;
}
else
{
a = a * 10 + 5;
textBox1.Text = a.ToString();
}
}
private void butn6_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "6";
a = 6;
}
else
{
a = a * 10 + 6;
textBox1.Text = a.ToString();
}
}
private void butn7_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "7";
a = 7;
}
else
{
a = a * 10 + 7;
textBox1.Text = a.ToString();
}
}
private void butn8_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "8";
a = 8;
}
else
{
a = a * 10 + 8;
textBox1.Text = a.ToString();
}
}
private void butn9_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "9";
a = 9;
}
else
{
a = a * 10 + 9;
textBox1.Text = a.ToString();
}
}
private void butn0_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0")
{
textBox1.Text = "0";
a = 0;
}
else
{
a = a * 10 + 0;
textBox1.Text = a.ToString();
}
}
private void butnsum_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
oper = "+";
b = a;
}
private void butnsub_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
oper = "-";
b = a;
}
private void butnmul_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
oper = "*";
b = a;
}
private void butndiv_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
oper = "/";
b = a;
}
private void butnper_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
oper = "%";
b = a;
}
private void butneql_Click(object sender, EventArgs e)
{
switch (oper)
{
case "+":
a = a + b;
textBox1.Text = a.ToString();
break;
case "-":
a = b - a;
textBox1.Text = a.ToString();
break;
case "*":
a = a * b;
textBox1.Text = a.ToString();
break;
case "/":
a = b / a;
textBox1.Text = a.ToString();
break;
case "%":
a = b % a;
textBox1.Text = a.ToString();
break;
}
}
private void butnce_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
}
private void butndel_Click(object sender, EventArgs e)
{
textBox1.Text = " ";
}
private void butndot_Click(object sender, EventArgs e)
{
if (textBox1.Text == ".")
{
textBox1.Text = ".";
}
else
{
textBox1.Text = textBox1.Text + "0.";
textBox1.Text = a.ToString();
}
}
}
}
 

Answers (3)