Multi-Select List Box in Primal Forms


I am still working my way through the learning process in PrimalForms, (excuse me Powershell Studio 2012). I was trying to create a multiselection list box without much success. I posted a plea for help on Sapien’s Scripting Answers board and got pointed to some articles on technet.


Here is the ListBox Control: ListBox Control

Here is the SelectionMode Property: SelectionMode Property

You can retrieve the selected items by enumerating the, what else,
‘SelectedItems property: SelectedItems property

When you build your form, grab the ListBox control from the left hand side of the page and place it on your new form. Size to your delight. Then on the far right side, Under BEHAVIOR, find SelectionMode and then select MultiSimple. This alows you to highlight more than one item in your ListBox. The first list box is named ListBox1 by default. Here is the code I used to process the items selected.


###### Start Posh Script ########

$status = $curItems = @()
	$curItems = $listBox1.SelectedItems
	foreach ($thing in $curItems) {
		$status += $thing
		$statusbar1.Text = "Curent Item = $thing"
		Command($thing)
		}
$richtextbox1.Text = "You selected these items $status"

############# End POSH Script ###############
Advertisements

3 thoughts on “Multi-Select List Box in Primal Forms

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s