文本框之间内容的互相传递

 1 namespace exchangeTest
 2 {
 3     public partial class exchange : Form
 4     {
 5         public exchange()
 6         {
 7             InitializeComponent();
 8         }
 9         //往文本框二添加文本框一的内容
10         private void btnExchange_Click(object sender, EventArgs e)
11         {
12             text2.Text = text2.Text + text1.Text;
13             btnExchange.Enabled = false;
14             btnExchange0.Enabled = true;
15             btnExchange.Focus();
16         }
17         //往文本框一添加文本框二的内容
18         private void btnExchange0_Click(object sender, EventArgs e)
19         {
20             text1.Text = text1.Text + text2.Text;
21             btnExchange0.Enabled = false;
22             btnExchange.Enabled = true;
23             btnExchange.Focus();
24         }
25         //窗体装载,初始化控件,文本框获得输入焦点
26         private void Form1_Load(object sender, EventArgs e)
27         {
28             text1.Text = null;
29             text2.Text = null;
30             text1.Focus();
31         }
32     }
33 }

 

posted on 2014-11-17 16:55  Failbs  阅读(138)  评论(0编辑  收藏  举报