I am trying to pass data from parent to child and child to parent.
I see how to get data from text boxes
how do I pass variables, arrays, datasets...
Thank you for any help you can provide.
Chris
Multi Forms Passing data bidirectional
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This forum is a space to discuss coding involving Graphical User Interfaces (GUI) in PowerShell or using WinForms controls, and technical issues related to development.
- Question about a licensed SAPIEN product? Post here: Product Support for Registered Users
- Question about a trial SAPIEN product? Post here: Former and Future Customers - Questions
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This forum is a space to discuss coding involving Graphical User Interfaces (GUI) in PowerShell or using WinForms controls, and technical issues related to development.
- Question about a licensed SAPIEN product? Post here: Product Support for Registered Users
- Question about a trial SAPIEN product? Post here: Former and Future Customers - Questions
Re: Multi Forms Passing data bidirectional
You may find the following helpful:
https://info.sapien.com/index.php/guis/ ... jects-work
https://info.sapien.com/index.php/guis/ ... jects-work
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Multi Forms Passing data bidirectional
This is on may Main form, but $MainForm_BiDerData always stays Tom in the main form even when I set it to Chris on the ChildFor
I am not sure what I am missing but it acts like a constant on the main form
I am not sure what I am missing but it acts like a constant on the main form
- $MainForm_Load= {
- #TODO: Initialize Form Controls here
- }
- $button1_Click= {
- #TODO: Place custom script here
- $script:MainForm_BiDerData = "Tom"
- if ((Show-ChildFor_psf) -eq 'OK')
- {
- $textbox1.Text = $MainForm_BiDerData #This stays set to Tom even though it is set to Chris in the Childfor
- }
- }
- $ChildForm_Load={
- #TODO: Initialize Form Controls here
- }
- $button1_Click={
- #TODO: Place custom script here
- $MainForm_BiDerData
- $MainForm_BiDerData = "Chris"
- $ChildForm.DialogResult = 'OK' #When I get here $MainForm_BiDerData shows Chris
- $ChildForm.Hide()
- }
Re: Multi Forms Passing data bidirectional
Since you are initially declaring the variable in the MainForm, its best to use the $script: scope when you reference/change that variable. This would mean updating the variable in the child form to the $script: scope.
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.