• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

passing a value from one form to another

I am building an application where, when a search button is clicked from any form, we get to a search form.  From here, I want to be able to pass the result to the original form where all the relevant fields for that record would get filled in text boxes.  How can I get back to the original form and how do I pass the value from Search form to original form.
0
bhavan
Asked:
bhavan
1 Solution
 
jgvCommented:
Add a Module to your project....select 'Project' - 'Add Module'. Declare any variables which should be visible to all forms within the module using the 'Global' declaration.

Global str as string
Global num as iteger
etc...

Use the hide/show to switch between forms.
Form1.hide          Form1.show

Declare a global variable that will indicate which form the search came from. Form1=1, Form2=2, Form3=3, etc. Make sure you udate the variable before proceeding to the 'search form'.
0
 
wfordCommented:
or better, if you set a type or an array in the search form as
public Results(0 to 4) as string

in your seach forma declare area, then you could referance these any where  (as long as your seach form is still loaded) by for example:

For n = 0 to 4
   text1(n) = frm_Search.Results(n)
next n
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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