winform你爱怎么传都行,反正你定义的公共变量哪里都可以使用

解决方案 »

  1.   

    例如
    parent_button1_click(..)
    {
        ChildForm form=new ChildForm(根据参数传递);
        form.Property1=11;根据属性传递
        form.SetCurrentValue(22);//用方法传递
        DialogResult result=form.ShowDialog();得到DialogResult
        string selectedValue=form.TheValue;//使用属性得到返回值..
    }
      

  2.   


    传出窗体的按钮单击事件
    private void button1_Click(object sender, System.EventArgs e)
    {    
    string s_mc;

    s_mc ="参数"; InitializeComponent();
    hpxx_tj frm= new hpxx_tj(s_mc); //传入窗体hpxx_tj
    frm.ShowDialog(); }//传入窗体hpxx_tj的public 部分
    public hpxx_tj(string s_mc) {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); textBox1.Text = s_mc; //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    }