Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

pass data with dialog result

How to pass data back from child form to main form using showdialog and dialog result.  I just know how to pass from main to child but not the other way around.  Please help!
Main Form:
 
Dim Frm as new form2
If frm.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
<perform some task>
end if
frm = nothing
 
Child Form:
 
Me.DialogResult = System.Windows.Forms.DialogResult.OK

Open in new window

0
johnyu1997
Asked:
johnyu1997
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can access the elements on Form2 directly via your "frm" variable:

    If frm.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
        ' grab a value from a textbox for instance:
        Dim entry As String = frm.TextBox1.Text
    end if
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now