Form1 ff=new Form1();
重新生成了一个新的Form,你要看到效果那么把它Show出来,如ff.Show();你要在原来Form上修改textBox1,那么这样this.textBox1.text="测试一下";
重新生成了一个新的Form,你要看到效果那么把它Show出来,如ff.Show();你要在原来Form上修改textBox1,那么这样this.textBox1.text="测试一下";
{
Form1 my = null;
public A()
{}
public A(Form1 f)
{
my = f;
}public SetText(string s)
{
if(my != null)
{
my.textBox1.text=s;
}
}
}
{
Form1 my = null;
public A()
{ }
public A(Form1 f)
{
my = f;
} public void SetText(string s)
{
if (my != null)
{
my.textBox1.Text = s;
}
}
}
调用的时候用下面的代码,注意要把textBox1的属性Modifiers设为Public
A a = new A(this);
a.SetText("测试一下");