title: Passing data between WinForms forms
body: <p>I have made a secondary form in my project which can get data from the main form, and  should pass some out to the main form when a button is clicked.<br>
  here is the code:   </p>
  
  <p><strong>Add.cs:</strong></p>
  
  <pre><code>        private void button1_Click(object sender, EventArgs e)
          {
              main ma = new main();
  
                  ma.optionType = "add";
                  ma.optionName = txtName.Text;
                  ma.optionURL = txtURL.Text;
                  ma.optionInterval = "12";
                  //What should I pass here?
  
  
              this.Close();
          }
  </code></pre>
  
  <p><strong>main.cs:</strong>   </p>
  
  <pre><code>  private string opt;// create a property
          public string optionType
          {
              get
              {
                  return opt;
              }
              set
              {
                  opt = value;
              }
          }
          private string opt2;// create a property
          public string optionName
          {
              get
              {
                  return opt2;
              }
              set
              {
                  opt2 = value;
              }
          }
          private string opt3;// create a property
          public string optionURL
          {
              get
              {
                  return opt3;
              }
              set
              {
                  opt3 = value;
              }
          }
          private string opt4;// create a property
          public string optionInterval
          {
              get
              {
                  return opt4;
              }
              set
              {
                  opt4 = value;
              }
          }
  </code></pre>
  
  <p>My problem is that I don't know when to try to fetch the data coming from add.cs after   button1 (in add.cs) was clicked. With what event should I check if the data came?</p>