///Form1.cs the form contains a textbox and a buttonusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 表單間通迅{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 frm = new Form2(this.textBox1); frm.Show(); } }}///Form2.cs the form contains a textbox and a buttonusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 表單間通迅{ public partial class Form2 : Form { private delegate void dg(); /// <summary> /// 讓其與表單1的TextBox1同一個引用。 /// </summary> private TextBox textBox12; public Form2() { InitializeComponent(); } public Form2(TextBox txtBox) { InitializeComponent(); textBox1.Text = txtBox.Text; ; this.textBox12 = txtBox; } private void button1_Click(object sender, EventArgs e) { textBox12 .Text = textBox1.Text; this.Close(); } }}