Skip to main content

I would like to get the items that the user has selected from a Lis tBox. I tried the following:

move ListBox::SelectedItem::ToString to STR-ITEM

This code works well if the 'SelectionMode" property of the ListBox is set to 'One' but this however, constrains the user to only pick one item from the List Box. I have set the  'SelectionMode" property of the ListBox  to 'MultiSimple' in order to allow the user to pick more than one item. But setting this property sems to only return the first item selected when I use the code above. I tried retrieving  the index using the following code:

move lst-GROUP-PROFL-TBL::SelectedIndex to THE-IDX-2.

But this too returns only the first item that is selected in the list. What I basically need is to retrieve all the items that the user has selected in a list box either by their string text or by their index and then store them in a table. For example, if the user chooses items 'January' 'February' and "March"  from a list box, I would like to store those items in a table. Storing the items in a table is fairly easy but I am stuck as I cannot seemed to get all the items that the user has selected from a List Box.

 

 

I would like to get the items that the user has selected from a Lis tBox. I tried the following:

move ListBox::SelectedItem::ToString to STR-ITEM

This code works well if the 'SelectionMode" property of the ListBox is set to 'One' but this however, constrains the user to only pick one item from the List Box. I have set the  'SelectionMode" property of the ListBox  to 'MultiSimple' in order to allow the user to pick more than one item. But setting this property sems to only return the first item selected when I use the code above. I tried retrieving  the index using the following code:

move lst-GROUP-PROFL-TBL::SelectedIndex to THE-IDX-2.

But this too returns only the first item that is selected in the list. What I basically need is to retrieve all the items that the user has selected in a list box either by their string text or by their index and then store them in a table. For example, if the user chooses items 'January' 'February' and "March"  from a list box, I would like to store those items in a table. Storing the items in a table is fairly easy but I am stuck as I cannot seemed to get all the items that the user has selected from a List Box.

 

 

You need to use the SelectedItems collection instead of SelectedItem.

 

Something like this:

01 table-num string occurs 5 times. declare sub1 as binary-long = 1 perform varying selecteditem as string thru listBox1::SelectedItems move selecteditem to table-num(sub1) add 1 to sub1 end-perform

You need to use the SelectedItems collection instead of SelectedItem.

 

Something like this:

01 table-num string occurs 5 times. declare sub1 as binary-long = 1 perform varying selecteditem as string thru listBox1::SelectedItems move selecteditem to table-num(sub1) add 1 to sub1 end-perform
This worked! Thank you.