Link to home
Start Free TrialLog in
Avatar of jes12345
jes12345

asked on

Returning string from multiline textbox to calling form VB.NET

I have a main form that opens a new form with a multiline textbox. When I doubleclick one of the lines in the multiline textbox I want the line to be returned to the main form. How can I do this?
SOLUTION
Avatar of roxviper
roxviper
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jes12345
jes12345

ASKER

Thanks for the clear example!
Avatar of Mike Tomlinson
I would also recommend setting DialogResult() in Form2 to "OK" or "Cancel" from Buttons so you can check that back in Form1:

    Dim f2 As New Form2
    If f2.ShowDialog() = DialogResult.OK Then

    Else

    End If

This gives you the option to trap whether the "dialog" was accepted or cancelled by the user.

In Form2:
 
    Private Sub btnClick_Click(...) Handles btnClick.Click
        Me.DialogResult = DialogResult.OK
    End Sub


    Private Sub btnCancel_Click(...) Handles btnCancel.Click
        Me.DialogResult = DialogResult.Cancel
    End Sub