Multiform project issue

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
dalizardking427
Posts: 3
Joined: Wed Sep 12, 2012 9:15 am

Multiform project issue

Post by dalizardking427 » Wed Sep 12, 2012 9:15 am

I am creating a Multiform project where the main form will have one textbox and one button. When I run the project, I want the user to enter data into that textbox and click the button. Once the button is clicked, there will be an action that loads data into different textboxes on a child form and displays the child form.

The problem I am having is putting text inside of the textboxes on the child form from the main form.

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

Multiform project issue

Post by davidc » Wed Sep 12, 2012 9:59 am

You will need to pass the values as parameters to the second form and use the second form's Load event set the textbox values.

Place a parameter block at the top of the second's form's editor:

param ($TextValue1, $TextValue2)


$form1_Load={

$textbox1.Text = $TextValue1
$textbox2.Text = $TextValue2
}

David
David
SAPIEN Technologies, Inc.

User avatar
dalizardking427
Posts: 3
Joined: Wed Sep 12, 2012 9:15 am

Multiform project issue

Post by dalizardking427 » Wed Sep 12, 2012 10:13 am

How does the second form know what $TextValue1 and $TextValue2 are?Here is what I have:On the Main form:$OnLoadFormEvent={#TODO: Initialize Form Controls here}$button1_Click={ #TODO: Place custom script here Call-ChildForm_pff $TextValue1 = "test" $TextValue2 = $textboxMain.Text}On the Child form:param ($TextValue1 , $TextValue2)$FormEvent_Load={ #TODO: Initialize Form Controls here $textbox1.Text = $TextValue2 $textbox2.Text = $TextValue2 }When I do this abd click button 1, the child form comes up but I do not get any data on my textbox1 and textbox2 on the child form.

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

Multiform project issue

Post by davidc » Wed Sep 12, 2012 11:18 am

When you use the Call-Function it will not exit until the child form is closed. Therefore you have to pass the text values to the Call-Function as parameters:Call-ChildForm_pff -TextValue1 "Text" -TextValue2 $textboxMain.TextThe parameters should be colored depending on how they were declared in the child form.FYI, in your code the $TextValue1 is in local scope. If you want a variable to be visible within your whole script/project use the script scope:$script:VariableName = valueDavid
David
SAPIEN Technologies, Inc.