Form1 public delegate void TestDelegate(int i); public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 frmOpen = new Form2(); frmOpen.ShowDialog(); } public void GetValueA(int i) { textBox1.Text = i.ToString(); } }Form2 public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int b; b = Convert.ToInt32(textBox1.Text); Form1 frm1=new Form1(); TestDelegate td = new TestDelegate(frm1.GetValueA); td(b); Close(); } }
public delegate void TestDelegate(int i); public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 frmOpen = new Form2(); frmOpen.ShowDialog(); } public void GetValueA(int i) { textBox1.Text = i.ToString(); } }
public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int b; b = Convert.ToInt32(textBox1.Text); Form1 frm1=new Form1(); TestDelegate td = new TestDelegate(frm1.GetValueA); td(b); Close(); } }