Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Form2.Show() AddHandler Form2.FormClosing, AddressOf Form2_FormClosing Me.Hide() End Sub Private Sub Form2_FormClosing(sender As Object, e As FormClosingEventArgs) If Form2.Result IsNot Nothing Then TextBox1.Text = Form2.Result End If Me.Show() End Sub
Private _result As String = Nothing Public Property Result As String Get Return _result End Get Set(value As String) _result = value End Set End Property Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click _result = TextBox1.Text Me.Close() End Sub