title: ShowDialog Form property is empty
body: <p>I have two of the simplest forms, with a couple of Buttons and a TextBox. I click to open the second form (frmModal) using ShowDialog(), type some text into txtGreeting and press the Yes button. What should happen is that a MessageBox appears confirming the text that was entered into txtGreeting, but it is empty.</p>
  
  <p>I understand that the Form's properties should be accessible until the form goes out of scope, but they disappear straight-away. I can't even read dialog.txtGreeting.Text.</p>
  
  <p>Am I missing anything obvious please?</p>
  
  <pre><code> Public Class frmMain
  
      Private Sub btnModal_Click(sender As Object, e As EventArgs) Handles btnModal.Click
          Dim dialog As frmModal
  
          dialog = New frmModal()
          Dim result As DialogResult = frmModal.ShowDialog(Me)
          If result = Windows.Forms.DialogResult.Yes Then
              MessageBox.Show(dialog.Greeting)
          End If
          'dialog.Dispose()
      End Sub
  End Class
  
  Public Class frmModal
          Public Property Greeting As String
              Get
                  Return txtGreeting.Text
              End Get
              Set(value As String)
  
          End Set
      End Property
  
      Private Sub btnYes_Click(sender As Object, e As EventArgs) Handles btnYes.Click
          MessageBox.Show(Greeting)
      End Sub
  End Class
  </code></pre>
  
  <p>The Yes button has it's DialogResult property set to Yes.</p>
  
  <p>I've tried moving the dialog-declaration out of the click-event, using an (unnecessary) Dispose(), deliberately assigning the Greeting property in the Yes-click event..</p>
  
  <p><a href="https://i.stack.imgur.com/y0uiL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y0uiL.jpg" alt="enter image description here"></a></p>