private void Button_Click(object sender, EventArgs e)
{
Child1 c1 = new Child1();
c1.MdiParent = this;
c1.Show();
this.TextBox.Text = c1.TextBox1_text;
};
-------------------你这样当然显示不了,你的子窗体不是刚显示出来嘛。你应该在 Button1 点击事件里 往父窗体里写
{
Child1 c1 = new Child1();
c1.MdiParent = this;
c1.Show();
this.TextBox.Text = c1.TextBox1_text;
};
-------------------你这样当然显示不了,你的子窗体不是刚显示出来嘛。你应该在 Button1 点击事件里 往父窗体里写
child1中
public delegate void returnvalue( int i );//类型可自己定义
public returnvalue ReturnValue;private void button1_Click(object sender, System.EventArgs e)
{
if ( ReturnValue != null )
ReturnValue( 8 );
}
Form中
private void Button_Click(object sender, EventArgs e)
{
Child1 c1 = new Child1();
c1.MdiParent = this;
c1.ReturnValue+=new Child1.returnvalue(showvalue);
c1.Show();
}
private void showvalue( int i )
{
textBox1.Text = i.ToString();
}
子窗体:
public delegate void returnvalue( int i );//类型可自己定义
public returnvalue ReturnValue;private void button1_Click(object sender, System.EventArgs e)
{
if ( ReturnValue != null )
ReturnValue( 8 );
}父窗体:
private void Button_Click(object sender, EventArgs e)
{
Child1 c1 = new Child1();
c1.MdiParent = this;
c1.ReturnValue+=new Child1.returnvalue(showvalue);
c1.Show();
}
private void showvalue( int i )
{
textBox1.Text = i.ToString();
}
public string Textbox1test
{
get
{
return Textbox1.Text;
}
} private void Button_Click(object sender, EventArgs e)
{
Child1 c1 = new Child1();
c1.MdiParent = this;
c1.Show();
this.TextBox.Text = c1.Textbox1test;
};