[Webinar] Streamline your web hosting managementRegister Today

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

Emergency!! passing value from form to calling form

Assume I have 2 forms of name parent and child.

Now I am originally in parent and open chld.  Now how do I pass or get values from this child to the parent.  The problem is that I want the child to be able to get the focus until the "OK" button is hit and the parent to receive the values only after the "OK" button on the child is hit and then get back the focus.  If anyone can help I will be greatly appreciative.  Thanks
0
cuchendu
Asked:
cuchendu
  • 2
1 Solution
 
AnswerTheManCommented:
1.make sure both are Loaded (not neccerily visible).
2. declare all Variabels you want to pass *PUBLIC*, in declaration section of each form.
----------------------------
advanced :
you may leave them private if you use Get and Let property functions.

0
 
AnswerTheManCommented:
to call from Form1 to var in Form2 :

Dim L as Long
L=Form2.SomeLongPublicGlobalVariable

to set Form2 var from Form1 :

Dim L as Long
L=2000
Form2.SomeLongPublicGlobalVariable=L

0
 
Erick37Commented:
'~~~~~Parent form~~~~~~~
Option Explicit

Public sString As String

Private Sub Command1_Click()
    frmChild.Show 1, Me 'Open the Child form as modal
    Caption = sString
End Sub

'~~~~~~Child Form~~~~~~~
Option Explicit

Private Sub Command1_Click()
    frmParent.sString = "Child wrote this"
    Unload Me
End Sub
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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