How to get values from a dialog form in VB.NET?

Viewed 46886

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 this dialog form "frmOptions" when a button "btnOptions" is clicked on the main form "frmMain", like this

Private Sub btnOptions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOptions.Click
    ShowOptionsForm()
End Sub

Private Sub ShowOptionsForm()
    Dim options = New frmOptions
    options.ShowDialog()
End Sub

How can I get in the main form "frmMain" the value inserted in the textbox "txtMyTextValue" when the "btnSave" is clicked?

4 Answers
Related