Administrator

Administrator

  • Admin
  • 2.2k
  • 1.4m

Passing data between MDI-children

Apr 15 2003 6:35 AM
I know there is a lot of talk about passing data between forms, but I do not understand. Take a look at this... My problem is passing data between MDIchildren. I´ve got no problem passing data from parent to a child, but between the children it seems not possible... When I press the button in Form1, the text appears in Form2´s textbox. But how do I reach the public method "send" from Form3? It can´t be that hard?! I´ve tried: this.MDIparent.send("whatever") but there is no send-method for the MDIparent... Yes it is!!! /****Form1 Mother*****************/ private Form2 frm2 = new Form2(); private Form3 frm3 = new Form3(); public void send(string str) { this.frm2.writeText(str); } private void Form1_Load(object sender, System.EventArgs e) { frm2.MdiParent = this; frm2.Show(); frm3.MdiParent = this; frm3.Show(); } private void button1Form1_Click(object sender, System.EventArgs e) { this.send("Show this text in textBox1 in frm2: From Form1"); } /************Form2*****************/ public void writeText(string str) { this.textBox1.Text = str; } /***********Form3******************/ private void button1Form3_Click(object sender, System.EventArgs e) { ?????.send("Show this text in textBox1 in frm2: From Form3"); }