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.
Am I missing anything obvious please?
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
The Yes button has it's DialogResult property set to Yes.
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..
This post has been edited by andrewsw: 20 October 2013 - 06:43 AM