c# 3 textbox calculator
DESCRIPTION
C# 3 textbox calcultor easy and simple codeTRANSCRIPT
-
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 L1{ public partial class Form1 : Form { int a = 10; int b = 20; public Form1() //constructor {
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { int c = a + b; string d = Convert.ToString(c); MessageBox.Show("sum is:" +d,"do u know"); } }}
*****************************************************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 LAb1Calculator{ public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void label1_Click(object sender, EventArgs e) {
}
private void button1_Click(object sender, EventArgs e) { string s1 = textBox1.Text.ToString(); string s2 = textBox2.Text.ToString(); int n1 = Convert.ToInt32(s1); int n2 = Convert.ToInt32(s2);
-
int ans = n1 + n2; s2 = Convert.ToString(ans); textBox3.Text = s2; }
private void textBox1_TextChanged(object sender, EventArgs e) {
}
private void textBox3_TextChanged(object sender, EventArgs e) {
}
private void textBox2_TextChanged(object sender, EventArgs e) {
} }}