For showing output in the TextBox we can use following:
Code:
using System;
using System.Drawing;
using System.Windows.Forms;

public class addnum : Form {

    Button Bsum  = new Button();

    TextBox textBox1 = new TextBox();
    TextBox textBox2 = new TextBox();
    TextBox textBox3 = new TextBox();

    

    public addnum() {
        Bsum.Location = new Point(40, 40);
        Bsum.Text = "sum";

        Bsum.Click += new System.EventHandler(this.bsum_Click);

        this.Controls.Add(bsum);

        textBox1.Location = new Point(15, 25);
        textBox1.Size = new Size(80, 10);
        textBox1.Text = "1int";
        this.Controls.Add(textBox1);

        textBox2.Location = new Point(15, 70);
        textBox2.Size = new Size(80, 10);
        textBox2.Text = "2int";
        this.Controls.Add(textBox2);

        textBox3.Location = new Point(15, 170);
        textBox3.Size = new Size(80, 10);
        textBox3.Text = "outputint";
        this.Controls.Add(textBox3);

        
    }

    private void bsum_Click(object sender, System.EventArgs e) {
        int a = Convert.ToInt32(textBox1.Text);
        int b = Convert.ToInt32(textBox2.Text);
        int c = a + b;
        textBox3.Text = c.ToString();
    }

    public static void Main(string[] args) {
        Application.Run(new addnum());
    }
}

Last edited by shabbir; 19Apr2010 at 18:50.. Reason: Code blocks
Kujuna like this