
两种方肆衡盯法:
一:在From2的 public Form2()中问号里添加 string strTxt
既 public Form1(string strTxt)
{
InitializeComponent();
this.textBox1.Text=strTxt;
}
在Form1的Button click 事件里
{
From2 f=new Form2(this.textBox1.Text.toString())
f.show();
}
二:
在Form2中裂和申明一个属性
string strTxt=“”:
public string StrTxt
{
get{ return strTxt: }
set{ strTxt=value: }
}
然后在窗体加载里写入 this.textBox1.Text=this.StrTxt;
在Form1的Button click 事件里
{
Form2 f=new Form2();
f.StrTxt=this.textBox.Text.toString();
f.show();
}
第一种方法方便,第拦差二种推荐使用,安全性高
写做个static的静态类!可以存储一些多个页面都要用经常用到重复性高的值