如何关闭父窗打开的所有子窗体或当前激活的子窗体呢 ?
我的是WINDFORM程序,用代码示例一下吧!!

解决方案 »

  1.   

    //关闭所有子窗体
    private void button2_Click(object sender, System.EventArgs e)
    {
    foreach (Form frm in this.MdiChildren)
    {
    frm.Close();
    }
    }
      

  2.   

    如何用一个FOREACH 循环获取本窗体所有的Textbox控件呢?
      

  3.   

    foreach(Control ctl in this.Controls)
    {
    if(ctl.GetType().ToString()=="System.Windows.Forms.TextBox")
    {
    ctl.Text="TextBox";
    }
    }