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.
Multiform project issue
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
Multiform project issue
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
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.
SAPIEN Technologies, Inc.
- dalizardking427
- Posts: 3
- Last visit: Mon Sep 24, 2012 10:07 am
Multiform project issue
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.
Multiform project issue
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.
SAPIEN Technologies, Inc.