로망와니 2010. 12. 7. 01:20

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
//                 MessageBox.Show("OK");
//            textBox1.Text = "우하하";
            int a = Convert.ToInt32(textBox1.Text);//들어온 문자를 숫자로 인식시키기 위해
            int b = Convert.ToInt32(textBox2.Text);
            int c = a + b;
            textBox3.Text = Convert.ToString(c);//더한 결과 값을 문자로 다시 입력시키기 위해서
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
        }

        private void button2_Click(object sender, EventArgs e)
        {
//            textBox3.Text = "textBox1.Text" + "textbox2.text";//글자
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(textBox2.Text);
            int c = a - b;
            textBox3.Text = Convert.ToString(c);
            //                a= Convert.ToInt32(textBox1.text) + Convert.ToInt32(textBox2.Text);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            textBox3.Text = textBox1.Text + textBox2.Text;//이렇게 더하면 텍스트 자체가 붙어서 나온다.
        }
    }
}