c#编程:窗体应用程序将用户输入在文本框1中的信息追加到文本2的后面

如题所述

第1个回答  2011-12-15
其实许多教材都有给的,慢慢学
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication5
{
public partial class Form1 : Form
{
string s;

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
s = textBox1.Text;
string b = s.ToUpper();
textBox1.Text = b;
}

private void button2_Click(object sender, EventArgs e)
{
s = textBox1.Text;
string b = s.ToLower();
textBox1.Text = b;
}

private void button3_Click(object sender, EventArgs e)
{
this.textBox1.Text = s;
}
}
}追问

怎么是 3个 button 啊?貌似不对吧!

追答

那你把你设置的Button连接就好了!

第2个回答  2011-12-15
//按钮单击
private void button1_Click(object sender, EventArgs e)
{
//textBox1.Text 文本框1
//textBox2.Text 文本框2
//追加
textBox2.Text = textBox2.Text + textBox1.Text;
}
第3个回答  2011-12-15
在textbox1 的textChanged 事件里 写 代码
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = textBox1.Text;
}本回答被提问者和网友采纳