First Part is getting the values from the multi-selection listbox. (SelectionMode="Multiple") I have tried 2 ways to get the selected values from the listbox:
'First Attempt -> Does not return the selected items
Dim itm As ListItem
For Each itm In SubLi.Items
If itm.Selected Then
str1 &= itm.Text
'Second Attempt -> Does not return the selected items
Dim ctr as Integer
For ctr=0 to SubLi.Items.Count()-1
str1 += SubLi.items(ctr).Text
Each of these 2 ways does not return the selected values - returns nothing. If I access directly it returns the value str1 = SubLi.items(1).Text but I need to do it in a loop to get all of the selected values. (Assuming this is the only way to get all of the selected items from a multi-listbox) Would be greatly appreciated if someone can point out where the logic is flawed in these loops, from what I can tell & reading some other solutions these should work.... but for some reason are not returning the selected items.
Part 2 - Set the defaults in the listbox. How do you set multiple selected items in a list box, ie want to pre-select the first and third items?