C#传递参数问题。。。。。

我在form1中定义了一个字符串str。。如何把它传递到form2。在form2中也可调用

form1:

string str = "...";
form2 f2 = new form2(str);
f2.Show();

form2:

private string str;

public form2(string str)
{
Init...
this.str = str;
}

楼上正解,此外你还可以设置公共(public)参数

参考我的详细回答

http://bbs.csdn.net/topics/360140208

直接在Form2的构造函数中传入就可以了,这种是最直接的。