I have two TextBox.
textbox1 ,textbox2
write csharp code addition of two textbox display in label
label.text=texbox1+textbox2
plz write csharp code.............
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 17, 2014, 6:35 AM
Shweta LodhaPosted Apr 17, 2014, 6:30 AM
Srikanth ReddyPosted Apr 17, 2014, 6:22 AM
AshishPosted Apr 17, 2014, 5:31 AM
JAYRAMPosted Apr 17, 2014, 5:27 AM
int b = Convert.ToInt32(Txt_2.Text);
int c = a + b;
Ans.Text = c.ToString();
above code write in pageload ...
i shows error
Ranjit PowarPosted Apr 17, 2014, 3:03 AM
private void button1_Click(object sender, EventArgs e)
{
double a, b,c;
a = Convert.ToDouble(textBox1.Text );
b = Convert.ToDouble(textBox2.Text);
c = a + b;
label1.Text = c.ToString();
}
AmanPosted Apr 17, 2014, 2:54 AM
I am embedding the Source Code also you can download it.
decimal add;
add=Convert.ToDecimal( textBox1.Text) +Convert.ToDecimal( textBox2.Text);
label3.Text = add.ToString();
Munesh SharmaPosted Apr 17, 2014, 2:30 AM
System.Decimal d = System.Decimal.Add(4.61m, 4.61m);
result is 9.22
Srikanth ReddyPosted Apr 17, 2014, 2:29 AM
var b=convert.ToDecimal(textbox2.text)
it will work
if you got correct answer click correct answer
JAYRAMPosted Apr 17, 2014, 2:26 AM
like 10.5
9.2
3.9
Srikanth ReddyPosted Apr 17, 2014, 2:26 AM
var b=convert.ToDecimal(textbox2.text)
Munesh SharmaPosted Apr 17, 2014, 2:13 AM
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Add
{
public partial class calci : Form
{
public calci()
{
InitializeComponent();
}
private void But_Add_Click(object sender, EventArgs e)
{
int a = Convert.ToInt32(Txt_1.Text );
int b = Convert.ToInt32(Txt_2.Text);
int c = a + b;
Ans.Text = c.ToString();
}
} }
JAYRAMPosted Apr 17, 2014, 2:04 AM
textbox2 value=2
shows error like incorrect string formot
Srikanth ReddyPosted Apr 17, 2014, 1:37 AM
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
int a = Convert.ToInt32(TextBox1.Text);
int b = Convert.ToInt32(TextBox2.Text);
label.text=(a+b).ToString();
}
AshishPosted Apr 17, 2014, 1:20 AM