Page 1 of 1

SubForm ComboBox variable not being set

Posted: Tue Jan 31, 2012 4:00 pm
by kghammonddc
We have a mult form project setup.

In the subform, we have one combobox. After selecting an item, we click ok and we return to the main form. We then look at the variable:

$subform_combobox and it is empty.

We even tried manually setting the variable on SelectedIndexChanged but it is still empty. We do see the variable in the Primal Forms IDE, so the variable appears to exist...

Do we need to use the Load-ComboBox for that to work?

Thank You,
Kevin

SubForm ComboBox variable not being set

Posted: Wed Feb 01, 2012 2:53 am
by davidc
Thank
you for reporting the issue. This will be resolved in the next service release.
In the meantime you could also save the value to another variable: $script:comboxValue =
$comboBox1.TextDavid

SubForm ComboBox variable not being set

Posted: Tue Feb 14, 2012 3:17 am
by kghammonddc
Thanks for the tip. We ended up creating globals to get around this issue.

Also we ran into a problem trying to set the index of a listbox or combobox when the listbox's source is a collection.

We ended up writing a function to do this. Since you have the Load-ListBox function you may want to do something similar for Selecting a listbox item.

Code: Select all

function SelectItem-ListBox { 
     Param ( 
          [System.Windows.Forms.ListBox]$listBox, 
          [string]$value 
     ) 
      
     for ($i=0;$i -lt $listBox.Items.Count;$i++) { 
          if ($listBox.Items[$i].Name -eq $value) { 
               $listBox.SetSelected($i,$true) 
          } 
     } 
      
}

SubForm ComboBox variable not being set

Posted: Tue Feb 14, 2012 5:38 am
by davidc
The last service build should have resolved the issue. David