Page 1 of 1

Passing data in a Multiform Project

Posted: Fri Oct 21, 2011 6:54 am
by burtcbl
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

Posted: Fri Oct 21, 2011 8:16 am
by davidc
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

Passing data in a Multiform Project

Posted: Mon Oct 24, 2011 1:58 am
by burtcbl
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

Posted: Mon Oct 24, 2011 3:06 am
by burtcbl
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.

Passing data in a Multiform Project

Posted: Mon Oct 24, 2011 4:07 am
by davidc


You the
"OK" refers to the way the form was closed. For example, if the user
clicked the "OK" button as oppose to the

Passing data in a Multiform Project

Posted: Mon Oct 24, 2011 4:10 am
by davidc
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

Passing data in a Multiform Project

Posted: Mon Oct 24, 2011 4:21 am
by burtcbl
Thanks David. I got it.

Passing data in a Multiform Project

Posted: Mon Mar 05, 2012 10:45 pm
by mssapien
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

Posted: Tue Mar 06, 2012 2:55 am
by davidc
The return values are not the control, but the string. In this case you just use: Write-Host $Form1_TextBox1 David