利用委托传值

 public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        public Form2(string str,Delegate de) : this()//调用当前空构造函数
        {
            label1.Text = str; //赋值
            this.de = de;//赋值     
        }
        private void Form2_Load(object sender, EventArgs e)
        {

        }
        private Delegate de;//定义委托类型字段
        private void button1_Click(object sender, EventArgs e)
        {
            string strmsg = textBox1.Text;
            if (de != null)
            {
                de(strmsg); //委托类型
            }
            this.Close();
        }
    }

 public Main1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string content = textBox1.Text;
            Form2 frm2 = new Form2(content,MsgStr); //初始化构造函数并赋值,参数中有需要委托类型(注:委托类型)
            frm2.Show();
        }
        private void MsgStr(string str)
        {
            textBox2.Text = str;
        }
    }

原文地址:https://www.cnblogs.com/haimingkaifa/p/5732217.html