Passing data in a Multiform Project

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
User avatar
burtcbl
Posts: 24
Joined: Tue Aug 04, 2009 6:06 am

Passing data in a Multiform Project

Post by burtcbl » Fri Oct 21, 2011 6:54 am

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?

User avatar
davidc
Posts: 5726
Joined: Thu Aug 18, 2011 4:56 am

Passing data in a Multiform Project

Post by davidc » Fri Oct 21, 2011 8:16 am

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
David
SAPIEN Technologies, Inc.

User avatar
burtcbl
Posts: 24
Joined: Tue Aug 04, 2009 6:06 am

Passing data in a Multiform Project

Post by burtcbl » Mon Oct 24, 2011 1:58 am

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.

User avatar
burtcbl
Posts: 24
Joined: Tue Aug 04, 2009 6:06 am

Passing data in a Multiform Project

Post by burtcbl » Mon Oct 24, 2011 3:06 am

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.

User avatar
davidc
Posts: 5726
Joined: Thu Aug 18, 2011 4:56 am

Passing data in a Multiform Project

Post by davidc » Mon Oct 24, 2011 4:07 am



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.

User avatar
davidc
Posts: 5726
Joined: Thu Aug 18, 2011 4:56 am

Passing data in a Multiform Project

Post by davidc » Mon Oct 24, 2011 4:10 am

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.

User avatar
burtcbl
Posts: 24
Joined: Tue Aug 04, 2009 6:06 am

Passing data in a Multiform Project

Post by burtcbl » Mon Oct 24, 2011 4:21 am

Thanks David. I got it.

User avatar
mssapien
Posts: 23
Joined: Tue Jan 03, 2012 4:39 am

Passing data in a Multiform Project

Post by mssapien » Mon Mar 05, 2012 11:45 pm

How do I fetch controls from Form1 to Form2?Code in Form1:Call-Form2_pffCode in Form2:Write-Host $Form1_TextBox1.TextDoes not work..

User avatar
davidc
Posts: 5726
Joined: Thu Aug 18, 2011 4:56 am

Passing data in a Multiform Project

Post by davidc » Tue Mar 06, 2012 3:55 am

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.