更新时间2018-12-09 00:52:25
将Form1中textbox值传到Form2———— Form1中代码
private void button1_Click(object sender, EventArgs e)
{
Form2 f = new Form2(textBox1.Text); //将值传到Form2
f.Show();
}
Form2代码:
public partial class Form2 : Form
{
string b; //你说的String变量
public Form2(string a) //a等同于Form1textbox值
{
this.b = a; //将Form1的textbox值传给b
InitializeComponent();
}