Page 1 of 1
Multi Forms Passing data bidirectional
Posted: Thu Nov 28, 2024 9:55 am
by CKMHC-it
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
Re: Multi Forms Passing data bidirectional
Posted: Sat Nov 30, 2024 11:29 am
by brittneyr
Re: Multi Forms Passing data bidirectional
Posted: Mon Dec 02, 2024 8:30 am
by CKMHC-it
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
$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
Posted: Thu Dec 05, 2024 7:59 am
by brittneyr
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.