I have a \"frmOptions\" form with a textbox named \"txtMyTextValue\" and a button named \"btnSave\" to save and close the form when it\'s clicked,
then, I\'m showing thi
You can access the value from the frmOptions instance. However, this breaks the law of demeter.
You should expose the value with a property within your class. Public Class frmOptions
Public ReadOnly Property MyTextValue As String
Get
Return Me.txtMyTextValue.Text
End Get
End Property
End Class
Then you can access the value:
Private Sub ShowOptionsForm()
Dim options = New frmOptions
Dim frmOptionTextValue As String
Dim frmOptionsDiagResult As DialogResult
frmOptionsDiagResult = options.ShowDialog()
If frmOptionsDiagResult = Windows.Forms.DialogResult.OK Then
frmOptionTextValue = options.MyTextValue
Else
'...
End If
End Sub
Finally, if you are using a Dialog then make sure to set the Dialog Result for the button.