SubForm ComboBox variable not being set

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
User avatar
kghammonddc
Posts: 13
Joined: Tue Jan 31, 2012 5:00 pm

SubForm ComboBox variable not being set

Post by kghammonddc » Tue Jan 31, 2012 5:00 pm

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

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

SubForm ComboBox variable not being set

Post by davidc » Wed Feb 01, 2012 3:53 am

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
David
SAPIEN Technologies, Inc.

User avatar
kghammonddc
Posts: 13
Joined: Tue Jan 31, 2012 5:00 pm

SubForm ComboBox variable not being set

Post by kghammonddc » Tue Feb 14, 2012 4:17 am

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) 
          } 
     } 
      
}

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

SubForm ComboBox variable not being set

Post by davidc » Tue Feb 14, 2012 6:38 am

The last service build should have resolved the issue. David
David
SAPIEN Technologies, Inc.