title: Get value in textbox of modal form upon return from form.ShowDialog
body: <p>I'm showing a modal form with 2 textboxes; first textbox is passed from the caller by passing a string to the constructor of the modal form. The 2nd textbox is blank and I type data into it and then click OK. </p>
  
  <p>I cannot retrieve the value typed into the 2nd textbox (in fact, a breakpoint in my btnOK_click code does not stop execution). </p>
  
  <pre><code>MetaDataForm getMetaData = new MetaDataForm(theRootFolder.FolderPath);
  getMetaData.ShowDialog();
  if (getMetaData.DialogResult == DialogResult.OK)
      {
          string d1 = getMetaData.Meta1;
          string d2 = getMetaData.Meta2;     // this is always null !
  </code></pre>
  
  <p>and in the modal form:</p>
  
  <pre><code>public partial class MetaDataForm : Form
  {
      public string Meta1 { get; set; }     // via auto-implemented properties
      public string Meta2 { get; set; }
  
      public MetaDataForm(string folder)
      {
          InitializeComponent();
          this.label1.Text = folder;
          this.Meta1 = ParseOutlookFolder(folder);
          this.txtMeta1.Text = this.Meta1;
      }
      private string ParseOutlookFolder(string folder)
      {
          string[] a = folder.Split('\\');
          return a[a.Length - 1];
  
      }
      private void btnOK_click(object sender, EventArgs e)
      {
          this.Meta2 = this.txtMeta2.Text;  // copy from text box into public property (not working?)
          this.Meta1 = this.txtMeta1.Text;
          this.DialogResult = DialogResult.OK;   // added per 1st reply below but no improvement
          this.Close();
      }
  </code></pre>
  
  <p>EDIT: Please note: </p>
  
  <p>When a breakpoint is set on this line in the btnOK_click event:</p>
  
  <pre><code>this.Meta2 = this.txtMeta2.Text;    // copy from text box into public property
  </code></pre>
  
  <p>..it is never "hit". Could this be why when I do stop execution on this line:</p>
  
  <pre><code>string d2 = getMetaData.Meta2;     // this is always null !
  </code></pre>
  
  <p>..it is always null ? </p>
  
  <p>In short, how do you grab a value from a form when you resume in the main code after showing a modal form?</p>