比如现在有一个窗体为Form1
Form1中有一个方法用来修改Form1中Label1控件的值:
public void setLabel1()
{
this.Label1.Text = "aa";
}比如现在有一个模式对话框为Form2
在Form2中:
Form1 fm = new Form1();
fm.setLabel1();//调用Form1中的方法但是根本就没修改呀,应该怎么办呢?
Form1中有一个方法用来修改Form1中Label1控件的值:
public void setLabel1()
{
this.Label1.Text = "aa";
}比如现在有一个模式对话框为Form2
在Form2中:
Form1 fm = new Form1();
fm.setLabel1();//调用Form1中的方法但是根本就没修改呀,应该怎么办呢?
openwindows()函数,获得返回值.
楼主的问题没有描述清楚~~~
Form1 fm = new Form1();
fm.setLabel1();
fm.Show();//缺了这句?
public Form2(Form1 form)
{
this.form1 = form;
}然后,就可以form1.setLabel1();//调用Form1中的方法