看这个FAQ:http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=4687

解决方案 »

  1.   

    textBox1.text = frm.comboBox1.Selectedtext
      

  2.   

    方法一:
    在父窗体中定义一个变量,取得comboBox1的值,
    将此值传进子窗体中。
    private string strParameter;
    某个事件中:
    strParameter=this.comboBox1.SelectedText;
    在new出子窗体的事件或方法中:
    ChildForm chfrm=new ChildForm(this.strParameter);
    在子窗体中:
    private string strResult;
    在构造函数中:
    public ch
      

  3.   

    设Form1为父窗体,Form2为子窗体;
    1.把父窗体中的ComboBox设为public;
    2.在子窗体中加上public Form1 f1;
    3.在父窗体打开子窗体时这样写:
    Form2 f2=new Form2();
    Form2.f1=this;
    f2.Show();
    4.在Form2_Load时写:
    string s=f1.ComboBox.Text;
    //s即为取到的Form1中的ComboBox的值;
      

  4.   

    public ChildForm(string para)
    {
     strResult=para;
    }
    这样直接访问strResult就可以取得父窗体的你所要的值了
      

  5.   

    在构造函数中:
    public ChildForm(string para)
    {
     strResult=para;
    }
    这样就可以直接访问strResult来获取comboBox1的text值了。
    对了这个this.comboBox1.SelectedText;
    应该改为this.comboBox1.Text;
      

  6.   

    也可以通过在父窗体中设置一个属性,在子窗体中访问这个属性来获得此值:
    在MainForm中:
    public string strParameter
    {
      get
      {
        return this.ComboBox1.Text;
       }
    }
    在ChildForm 中:
    MainForm frm=new MainForm();
    strResult=frm.strParameter;
      

  7.   

    91bct(行人)大哥:
    小弟笨,能把下面的代码再贴出来吗?谢谢
      

  8.   

    如果斑竹这两句:
    mainfrm frm = new mainfrm(); 
    textBox1.text = frm.comboBox1.text
    是在一起的话,无论怎么写都是空的。有几点不明白:
    1.那个是父窗体呢?是mainfrm还是另一个?
    2.如果mainfrm是父窗体,为什么在子窗体启动父窗体呢?
    3.如果mainfrm不是父窗体,第二句话就不应该写在这里。
      

  9.   

    在子窗口设置一个属性,用来传递参数。
    例如:
    子窗口:
    private string strName1 = "";
    public string strName
    {
         get
         {
              return strName1
         }
         set
         {
              strName1 = value;
         }
    }
    在主窗口:
    frmChild frmChild = new frmChild();
    frmChild.strName = this.comboBox1.text;
    frmChild.show();然后在loading子窗体的方法中,为你的textBox 初始化:textBox1.Text = strName1;
    或者直接把子窗口的textBox设置为public(我认为不是很好啦。)
    frmChild frmChild = new frmChild();
    frmChild.textBox1.Text = this.comboBox1.text;
    frmChild.show();