Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That error is thrown because Form3 has no default Constructor anymore since you defined one with a <code>string</code> parameter. you need to create a default Constructor like this <code>public Form3(){}</code>. </p> <p>But Instead of doing all this mess you can handle events of you both forms. Like if Form1 is the main Form then something like this can be done:</p> <p>In Form1</p> <pre><code>public string textFromForm2 = string.Empty; private void openform3_Click(object sender, EventArgs e) { Form3 f3 = new Form3(); f3.Controls["received_from_form1_textbox"].Text = textFromForm2 ; f3.Show(); } private void OPENFORM2_Click(object sender, EventArgs e) { Form2 f2 = new Form2(); //I am binding the event to a handler which will save text //you should check for null for f2.Controls returned any thing or not, i am leaving it for now f2.Controls["send_to_form1_button"].Click += (s,e)=&gt;{ txtFromForm2 = f2.Controls["form2_textbox"].Text; }; f2.Show(); } </code></pre> <p><strong>Update</strong></p> <p>if you don't want to use Lambadas then bind events like this:</p> <p>First you will need a reference to the Form2 so declare in your class like this:</p> <pre><code>Form2 f2; </code></pre> <p>then bind the event (in place of the lambada i have given before)</p> <pre><code>f2.Controls["send_to_form1_button"].Click += new Eventhandler(click_handler); </code></pre> <p>then somewhere in Form1 class:</p> <pre><code>protected void click_handler(object sender, EventArgs e) { if(f2 != null) txtFromForm2 = f2.Controls["form2_textbox"].Text; } </code></pre> <p>similarly for Form3.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload