I am having a very hard time figuring out how to pass data between the multiple forms in a multiform project. I want to be able to bring up a separate child form, select some data in that child form and when that form closes, the selected data will be used to update the contents of a textbox on the main form.
I find little to nothing in the way of help in your documentation. Is there anyone out there that has done this?
Passing data in a Multiform Project
Passing data in a Multiform Project
You can call one form from another in a Project by using the
reference function name. For example, to call Form2.pff,
use the reference function: Call-Form2_pff.When you use the reference function it will automatically
generate variables for certain types of controls. For example, if the Form2 has
a ComboBox and TextBox control it will return the following variables
containing the selected values:$Form2_comboBox1$Form2_textBox1The variables each return variable name consists of the form
reference function name. For example, to call Form2.pff,
use the reference function: Call-Form2_pff.When you use the reference function it will automatically
generate variables for certain types of controls. For example, if the Form2 has
a ComboBox and TextBox control it will return the following variables
containing the selected values:$Form2_comboBox1$Form2_textBox1The variables each return variable name consists of the form
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Passing data in a Multiform Project
I'm having some problems making this work. I'm confused as to where you're getting the return "OK" from the called form. I assume that is a button but I'm not sure.
Passing data in a Multiform Project
OK, I got it to work by putting the
write-host statement after the If statement. I'm still not sure how you get the called form to return a value of "OK" . Need clarification on that.
write-host statement after the If statement. I'm still not sure how you get the called form to return a value of "OK" . Need clarification on that.
Passing data in a Multiform Project
You the
"OK" refers to the way the form was closed. For example, if the user
clicked the "OK" button as oppose to the
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Passing data in a Multiform Project
FYI, you can always ignore the return value if you like. Use if only if you care if the user cancels an action or not. David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Passing data in a Multiform Project
How do I fetch controls from Form1 to Form2?Code in Form1:Call-Form2_pffCode in Form2:Write-Host $Form1_TextBox1.TextDoes not work..
Passing data in a Multiform Project
The return values are not the control, but the string. In this case you just use: Write-Host $Form1_TextBox1 David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.